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

Started by Baystep, January 03, 2015, 04:44:44

Previous topic - Next topic


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?


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.


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.


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.