LWJGL Forum

Programming => OpenGL => Topic started by: TechNick6425 on July 14, 2013, 00:19:20

Title: Rendering in OpenGL?
Post by: TechNick6425 on July 14, 2013, 00:19:20
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?
Title: Re: Rendering in OpenGL?
Post by: 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(...)
Title: Re: Rendering in OpenGL?
Post by: TechNick6425 on July 23, 2013, 00:31:52
Thanks for the info! Now I can make my game!
Title: Re: Rendering in OpenGL?
Post by: M3gaFr3ak on October 03, 2013, 15:04:05
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?
Title: Re: Rendering in OpenGL?
Post by: quew8 on October 03, 2013, 18:40:15
The functions in GL11 are all static, whereas a regular import only imports non-static methods. Use a static import as shown above.