using later GL standards without depricated older standards

Started by chris_c, November 22, 2014, 09:43:08

Previous topic - Next topic

chris_c

I like the way the tests statically import GL1.1 however the structure of the bindings seems to be there is no way to use say *just* GL3.3 without importing some deprecated bits of GL1.1 (I could be wrong!)

If I want use say GL3.3 and I want to use GL_TRUE etc I seem to need to import GL1.1 as well.

However it would be quite possible for me to then use some deprecated function of GL1.1 and end up with a not really GL3.3 application...

Do bleeding edge cards even know about glVertex (for example) ? can they even run in GL1.1 mode ?

Is it quite possible to accidentally make an app that might work on one card but baulk at some post deprecated function ?

Am I missing something here ?

Cornix

It is not like GL11 contains only deprecated functionality. Rather GL11 contains all functionality that was present at OpenGL version 1.1.
Methods like GL11.glEnable(param) are still used even in OpenGL Version 4.X.

OpenGL is also downwardly compatible. Newer cards can still use OpenGL 1.1 functionality, in the worst case it will be done by the software driver that will translate it to newer methods for the graphics card.

chris_c

I kinda suspected that would be the case, I don't doubt you at all, but out of curiosity can you cite an official source for this backwards compatibility? (you never know I might learn something!)

spasi

You can use the forward compatibility flag when creating the OpenGL context. With GLFW, this means:

glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

This will be detected by LWJGL and it will not load function pointers for any deprecated OpenGL function. This will work with either Core or Compatibility profile contexts, which is important, because using the Core profile often means additional driver overhead. Note this will only work with functions, LWJGL cannot do anything about deprecated constants. You can use a Core profile context to be absolutely sure:

glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // requires OpenGL 3.2 or later

For more information, see Core and Compatibility in Contexts.

On legacy functionality, modern GPUs indeed have no hardware dedicated to obsolete OpenGL features. They're emulated with shaders managed by the driver.

chris_c

I had to also add
        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // Use OpenGL Core v3.2
        glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);

or am I doing something wrong?

spasi

GLFW_OPENGL_FORWARD_COMPAT requires OpenGL 3.0+ and GLFW_OPENGL_PROFILE requires OpenGL 3.2+.

ra4king

-Roi