PDA

View Full Version : Confuzed with ARB and Core extensions!



Spongebob
11-16-2008, 05:22 AM
Hello all!!
I am trying to initialize some extensions.. I also looked some source code I found on the internet but I have some questions: take a look at these two lines:


glCreateProgram = (PFNGLCREATEPROGRAMOBJECTARBPROC) wglGetProcAddress("glCreateProgram");

glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) wglGetProcAddress("glCreateProgramObjectARB");

The above lines are from two different source codes I found.
What is the difference between glCreateProgram() and glCreateProgramObjectARB()? Yes.. I know.. the first one is for OpenGL Core and the other for ARB Extension. But what is the actual difference? Don't they do the same thing? maybe the one maps to the other, so it is EXACTLY the same?
If glCreateProgram is the Core one why is it casted to PFNGLCREATEPROGRAMOBJECTARBPROC which the "ARB" inside? why not PFNGLCREATEPROGRAMOBJECTPROC? That is better to use? ARB or Core extensions? (the target machine for my project will ALWAYS be a GeForce9600mGT which is OGL v2.1 compatible.)
Can I mix up Core and ARB extensions for shaders? (if they are mapped to each other I don't think there will be a problem, but.. are they mapped to each other? )

PS: I must init the extensions myself, I can't use GLEW (don't ask why :P)

Thanks for your time!

Rosario Leonardi
11-16-2008, 06:37 AM
This is caused because a openGL function make a long road before enter in the core.
For example, nVidia create a new technology and want people to use it. The first time that nVidia insert the extension to the library is marked as proprietary extension. If the extension is further approved the proprietary extension can became an ARB extension and then inserted in the core.
Between these passages some functions are refined and sometime function and parameter are changed, sometime change only the name. :)
ARB has never removed extension from library for backward compatibility, so you will find both.

The cast type PFNGLCREATEPROGRAMOBJECTARBPROC is the same cause both function take a GLenum as parameter and return an int.

If you always use a modern card like a 9600 you don't have to worry about retro-compatibility, so you can use the core without problem.

Here you can find a tutorial that use both function:
http://www.lighthouse3d.com/opengl/glsl/index.php?oglshader