Hello Guest

Rendering in OpenGL?

  • 4 Replies
  • 5019 Views
Rendering in OpenGL?
« 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?
« Last Edit: July 14, 2013, 00:30:27 by TechNick6425 »

*

Offline ic5y

  • *
  • 19
Re: Rendering in OpenGL?
« Reply #1 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
Code: [Select]
import static org.lwjgl.opengl.GL11.*, you can write it like C functions: glVertex3f(...)

Re: Rendering in OpenGL?
« Reply #2 on: July 23, 2013, 00:31:52 »
Thanks for the info! Now I can make my game!

Re: Rendering in OpenGL?
« Reply #3 on: October 03, 2013, 15:04:05 »
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
Code: [Select]
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?

*

Offline quew8

  • *****
  • 569
  • Because Square Eyes Look More Real
Re: Rendering in OpenGL?
« Reply #4 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.