Changing from GL11 to OGL 3

I have been using Vertex Arrays and Interleaved VBOs as described here

I thought that this was the way to go until someone said that GL11 is deprecated and we should be using OpenGL 3 with Vertex Arrays and VBOs.

I am confused as I am using Vertex Arrays and VBOs, but I am still only using GL11 and GL15, not GL30. ???

Can someone please clarify what I should be using, and point me to a tutorial if my current usage is inefficient.

Thanks! :slight_smile:

The newer OpenGL classes (GL30, GL31, etc) still rely on functions and enums from the older ones. The screen is still cleared with GL11.glClear(), VBOs are still created with GL15.glGenBuffers() and shaders programs are still created with GL20.glCreateProgram(). The difference is that a number of functions in those classes have been deprecated and can no longer be used (unless you’re using the compatibility mode, which kind of defeats the purpose of it). For example, here’s a line from when using sampler objects which store how a texture is sampled (filtering, wrap modes, etc) separately instead of inside the texture:


GL33.glSamplerParameteri(id, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);

As you can see, the old GL11 enums are still used although the function glSamplerParameteri() is in GL33.

I’d like to point out that switching to OGL3 does not only mean that you’ll have to use VBOs; the whole fixed functionality pipeline has been removed. For starters, it’s impossible to draw anything at all without a shader.

Okay, I’ll finish my current project, then think about switching afterwards

I did know that some methods were not deprecated in the older classes, but I didn’t know which ones, so I wanted to make sure.

Can you confirm whether the VAO method in the article mentioned in my first post is good to use or not?

Thanks

From that article, any of those techniques that use VBOs are all okay (indexed, interleaved, etc). Vertex arrays are deprecated though (simply sending in a FloatBuffer to gl*****Pointer()). To convert them to OGL3 you’ll also need to use shaders with custom shader attributes instead of the built-in shader attributes. glVertexPointer(), glColorPointer(), glTexCoordPointer(), etc are all replaced by a generic function called glVertexAttribPointer() and glEnableClientState() is replaced by glEnableVertexAttrib(). But for now, stick to using VBOs the way you currently do and worry about shaders in your next project! :wink:

It would be more explicit if there were separate interfaces for OpenGL 3.1 backward compatible profile and OpenGL 3.1 forward compatible profile. The fixed functionality pipeline has been removed from the core but it is still available in the optional extension ARB_compatibility.

http://lwjgl.org/javadoc/org/lwjgl/opengl/ContextAttribs.html

Set it up and feed it into Display.create().