OpenGL 3.0+ in LWJGL

Started by steventrouble, September 21, 2011, 00:45:51

Previous topic - Next topic

steventrouble

Hello all,

I'm not entirely sure what the advantages are over 1.1, but I have always been one to think the latest and greatest is also the most optimized, etc, and have rarely been proven wrong in this regard. Are there any tutorials that describe how to use LWJGL with 3.0+?

Thanks!
- Steven

kodia

I'm new at OpenGL and am having issues with 3.0 but there are some tutorials out there that are in C or C++ but they fit basically 100% to LWJGL. The basics for 3.0 to my understanding are you need VAO and VBO's because all other types of drawing are deprecated.

Commands like
GenVertexArray make a new VAO for you
GenBuffer makes new VBO
Attach the VBO to a VAO then draw with any command.

Someone else could give more details on it but opengl.org has a wiki that has 3.0-3.3 tutorials on all sorts of stuff
Shaders are a must now and YOU write them. 3.0+ basically removed all fixed function of the lower versions so you now make all shaders to draw color and any special effect.

Best of luck to you.

-edit- Just for a WORKING OpenGL 3.3 LWJGL example I have a thread I made that I finally got working that draws a simple primitive in green.
I don't have a great explanation to go along with it but if you play around with my code you should get the basic idea. It should help you get started. The thread is on this forum called "Strange drawing issue in 3.3 OpenGL". Remove the quotes because I just wanted to make it seperated from the rest of the sentance. Best of luck getting started.

steventrouble

"Just for a WORKING OpenGL 3.3 LWJGL example I have a thread I made that I finally got working that draws a simple primitive in green."

That is exactly what I needed! Thanks! :D

steventrouble

Nevermind XP The example helped a lot, but now I have another question:

Weren't some methods removed from OpenGL 3.1+? If this is the case, what do I have to import, etc, to essentially be using the latest specification of OpenGL? Currently, when I import just for GL31-GL41, I lose a ton of the basic GL methods which I'm assuming I need...

kodia

Well how LWJGL does it you need to import most of the old ones because they don't remove the old deprecated ones so I use the techincal manual/reference to know what is still current. They only add the new commands for the version they are added like when in 3.0 the VAO became core instead of an extension. glGenVertex() is a part of GL30. You still need the VBO commands from GL20 or so. ect ect. I just import ALL the ones from the version i am using to GL11 just in case.

Your program IDE/compiler ect should alert you to non used imports so if you really don't need them you can remove them. I don't think anything really happens if you have unused imports but I'm not an expert reference. Could do this once your program is "final" and it will be fine.

If this was the C/C++ version you would only import the version you want. But obviously its the java one ^_^

Not sure if links are allowed but this is a good list of all useable commands for a version
http://www.opengl.org/sdk/docs/
Sorry if we shouldn't  have links.
Click on 3.3 spec and all deprecated methods will be unlisted. Or use the specifications pdf to also see what isnt supported anymore

Cubic

You need to import the classes for the older opengl versions for those. I don't particularily like that, but whatever. If you do that though you should probably declare your context as forward compatible if you want to avoid using deprecated functionality.