Rendering in OpenGL?

Started by TechNick6425, July 14, 2013, 00:19:20

Previous topic - Next topic

TechNick6425

I was wondering how the OpenGL syntax is translated to the LWJGL. I want to make a game, and I can get an OpenGL book, but how do the syntax calls transfer to the LWJGL? e.g. glBindBuffer() = ?

UPDATE: I'm looking at the LWJGL Javadoc, and now I'm wondering how LWJGL syntax is similar to native C syntax e.g. glVertex3f(1.0f, 1.0f, 1.0f) == C Syntax?

ic5y

It's almost the same. But you have to use GL* prefixes, so glVertex3f in LWJGL is GL11.glVertex3f. You have to know which OpenGL version contains the function you want to use. You can use static imports, so with
import static org.lwjgl.opengl.GL11.*
, you can write it like C functions: glVertex3f(...)

TechNick6425

Thanks for the info! Now I can make my game!

M3gaFr3ak

Quote from: ic5y on July 14, 2013, 14:16:01
It's almost the same. But you have to use GL* prefixes, so glVertex3f in LWJGL is GL11.glVertex3f. You have to know which OpenGL version contains the function you want to use. You can use static imports, so with
import static org.lwjgl.opengl.GL11.*
, you can write it like C functions: glVertex3f(...)


if I import GL11.*; it can't find the glDOSTUFF methods, i always have to type GL11.glDOSTUFF()... is there a way to fix that?

quew8

The functions in GL11 are all static, whereas a regular import only imports non-static methods. Use a static import as shown above.