Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  (OpenGL or own)Matrix functions, Render a Mesh many times (Geometry Instancing?)  (Read 890 times)
0 Members and 1 Guest are viewing this topic.
Offline NullPointerException

Innocent Bystander





« Posted 2013-01-20 16:03:51 »

Hi, I want to learn OpenGL using LWJGL. So far I have read the following articles.

LWJGL Basics 1 (The Display)
LWJGL Basics 2 (Input)
LWJGL Basics 3 (The Quad)
LWJGL Basics 4 (Timing)
LWJGL Basics 5 (Fullscreen)

Version selection
The Quad with DrawArrays
The Quad with DrawElements
The Quad colored
The Quad interleaved
The Quad textured
The Quad updating a VBO with BufferSubData
The Quad with Projection, View and Model matrices


Now to my questions:

1. Can anyone recommend what I should read next?
2. Does it make sense to use the matrix functions such GL11.glMatrixMode(),  GL11.glLoadIdentity() and GLU.gluPerspective() or should I immediately begin to do everything by hand, as described here?
3. How can I render a mesh(eg cubes) effectively many times? Should I do it with Geometry Instancing?
Offline sproingie

JGO Kernel


Medals: 202



« Reply #1 - Posted 2013-01-20 17:09:37 »

1. I'd recommend going next with http://www.arcsynthesis.org/gltut/ which covers the modern OpenGL pipeline.  Reading that will give you some answers to your next two questions, but just to touch on them:

2. Once you get into the programmable pipeline, you find all the matrix manipulation functions have been deprecated, and you'll indeed have to do them by hand.  That said, the math for a projection matrix is tedious, and you'll probably end up having to copy the bulk of gluPerspective into a utility function to do it anyway.

3. Instancing is one way to do it, sure, but I would stick with using a VBO first.  Once you get into the culling needed to efficiently render a voxel cube world, instanced geometry is going to be a lot less convenient than manipulating the whole set of vertices directly.


Offline davedes
« Reply #2 - Posted 2013-01-20 18:24:01 »

1. IMHO the first step would be to learn shaders and the programmable pipeline, probably using a utility library to help you along the way. After that, you can start developing your own engine (if you feel it's necessary) or you can continue to use something like LibGDX for convenience.

I cover a variety of GL topics here:
https://github.com/mattdesl/lwjgl-basics/wiki

You can also read up on other modern GL series, like Arcsynthesis. Note that most of them will be GL 3.3+, and therefore not work on Mac 10.6, nor OpenGL ES (WebGL/iOS/Android).

http://tomdalling.com/blog/category/modern-opengl/
http://open.gl/
http://opengl-tutorial.org/

Understanding the basics of the pipeline (vertex attributes, shaders, etc) are essential to developing "modern" GL apps. If you don't care to learn modern GL, and are OK with using deprecated code, you can stick to old tutorials like NeHe. This includes things like glMatrixMode, glLoadIdentity and GLU.

2. Usually it makes sense to use a utility library like LWJGL's matrix classes, or those in LibGDX. If you really want to write your own vector/matrix utilities, of course, nothing is stopping you...

3. More important than instancing would be culling faces, assuming you are doing something a la Minecraft. As sproingie said, VBOs are a better place to start.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Phibedy

Senior Member


Medals: 8



« Reply #3 - Posted 2013-01-22 23:09:06 »

1. After I did every tut I could find, I just started programming on my own.
One huge and well written blog: http://fgiesen.wordpress.com/2011/07/01/a-trip-through-the-graphics-pipeline-2011-part-1/

3.I don't know if it's the most effective way, but for rendering my tilemap, I collect all the vertices and texture-coords (from the texture-atlas, think of caching it, because the find("name") is quite slow) in a huge float[], in addition I add the indices. I think, that Triangles are rendered much faster.
You should call the draw() and bind() method as little as possible.
One problem about "geometric-mesh-rendering" is, that you have to thing of the size of the indices-array, it's a short[]. Therefore I create for each chunk a own mesh and render it. I pass 18 mb per second, but that's no problem, if you think for example about smartphones, the cpu + gpu are on the same chip -> you don't really have to care about it bottleneck.

One great lib is libgdx, it has a lot of great features and offers you full opengl-"action".
best regards
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (19 views)
2014-09-12 09:08:26

Norakomi (54 views)
2014-09-10 13:57:51

TehJavaDev (63 views)
2014-09-10 06:39:09

Tekkerue (31 views)
2014-09-09 02:24:56

mitcheeb (53 views)
2014-09-08 06:06:29

BurntPizza (37 views)
2014-09-07 01:13:42

Longarmx (23 views)
2014-09-07 01:12:14

Longarmx (27 views)
2014-09-07 01:11:22

Longarmx (26 views)
2014-09-07 01:10:19

mitcheeb (34 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!