Hello Guest

LWJGL 3 - Which static class to use for common OpenGL Calls?

  • 3 Replies
  • 9524 Views
So I grabbed the new stable version of LWJGL 3, and I like it for exactly the reasons that they had for re-writing it. My only issue is that I'm used to just typing the OpenGL functions without needing the prefixed static class of the version. So this is making it hard for me to develop since I don't have the different versions memorized.

ie: I couldn't figure out for the life of me which version "glEnableVertexAttribArray" was in for the life of me. Until I used google and just used this querry "site:http://javadoc.lwjgl.org/ glEnableVertexAttribArray"

So my question to the forums, is there any kind of "cheat sheet" for this? Would I have to write up some source crawler to generate this? Should I just deal with it and keep all 17 files open to check each one? Should I write my own static class as a wrapper for common functions?
« Last Edit: January 03, 2015, 04:47:08 by Baystep »

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL 3 - Which static class to use for common OpenGL Calls?
« Reply #1 on: January 04, 2015, 00:23:25 »
This is what I do in IntelliJ IDEA (using glEnableVertexAttribArray as an example in an file without GL imports):

- I type glEVAA
- Ctrl+Space (no results)
- Ctrl+Space again, I get GL20.glEnableVertexAttribArray();
- Then I move the cursor on GL20 -> Alt+Enter -> "Add on demand static import for GL20"

At the end I have just glEnableVertexAttribArray() in the code and an import static org.lwjgl.opengl.GL20.*. I never have to manually search where a function is defined and there are no class prefixes in the code.

Other IDEs may do this differently, or not at all. If you aren't using an IDE, you could use the javadoc index (index-all.html). Do not use the site, it's a massive 8MB+ file.

Re: LWJGL 3 - Which static class to use for common OpenGL Calls?
« Reply #2 on: January 04, 2015, 06:03:58 »
Thanks for the suggestion. I've figured out that so far my commands are either GL15, GL20, or GL30 since I'm targeting OpenGL 3.2 (for my own hardware limitations). So that isn't taking to long I guess. I'll see what Eclipse offers in that area, otherwise opening my hard copy of the javadoc should suffice.

*

Offline ra4king

  • **
  • 58
  • I'm the King!
    • Roi's Website
Re: LWJGL 3 - Which static class to use for common OpenGL Calls?
« Reply #3 on: January 04, 2015, 23:33:36 »
Eclipse offers the ability to have "Favorite" classes where it statically imports from them on demand, you can find it at: Window » Preferences » Java » Editor » Content Assist » Favorites. Add all the GLXX classes.
-Roi