Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 2677 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 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:

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).

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 Devvie

Medals: 9

« 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:

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  

EgonOlsen (45 views)
2018-06-10 19:43:48

EgonOlsen (25 views)
2018-06-10 19:43:44

EgonOlsen (47 views)
2018-06-10 19:43:20

DesertCoockie (202 views)
2018-05-13 18:23:11

nelsongames (127 views)
2018-04-24 18:15:36

nelsongames (126 views)
2018-04-24 18:14:32

ivj94 (867 views)
2018-03-24 14:47:39

ivj94 (128 views)
2018-03-24 14:46:31

ivj94 (771 views)
2018-03-24 14:43:53

Solater (143 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!