Ok, I finally have found a time to get back to OpenGL, and since GL 3.0 is out, I decided to start from here.

Unfortunately, I cannot even initialize 3.0 in a clean way, and there are quite a few questions I cannot find an answers for.

The questions that confuse me are:

1) Version strings
If I call functions to retrieve version on legacy context, they all return 3.0. Is that something I can rely on, or is it possible that old context will return 2.1 and the new one 3.5 for example? Seems that if I have 3.5 and I query 3.0, then old context will say 3.5, but the new one 3.0?
glGetIntegerv(GL_MAJOR_VERSION, &major);//3
glGetIntegerv(GL_MINOR_VERSION, &minor);//0
glGetString(GL_VERSION);//3.0.0

2) wglGetExtensionsStringARB and wglCreateContextAttribsARB
Both functions are necessary to create 3.0 rendering context in Windows, but what is the correct way to query them?
Can I rely on GL version, or do I have to check the extension string first? If I have to check the extension string, what is the purpose of the GetStringi? I will have to resort to glGetString(GL_EXTENSIONS) anyway because there is no GetStringi in GL 1.0. What is the minimal OpenGL version requirement for GetStringi?

3) Extension strings in legacy/future contexts
Do I have to requery extension string in 3.5 context if I have done that in legacy context? Are the extensions supposed to change GL/WGL/GLX?

4) WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
Why is glGetStringi(GL_EXTENSIONS, i) failing with error 0x500 (GL_INVALID_ENUM) in forward compatible context?
glGetString(GL_EXTENSIONS) is supposed to be deprecated, but isn't the glGetStringi the correct way to query extensions now? It works without forward compatible bit though, NVIDIA, FW 182.06.

5) wglGetProcAddress
Do I have to requery function addresses in GL 3.5 if I have queried them under legacy context?

1. Version queries seem to work with the added twist that in a GL3 context you use the new entry points.

2. You need a valid context to get either of these procs anyway (a bit like creating a multisample context).

3. The MSDNL suggests that the procs belonging to one context (pixelformat?) are not necessarily valid in another, tho in practice this restriction/warning may be relaxed/lifted. Anyway the pattern of first creating a "default" context followed by the version du jour seems to be our lot in life going forward.

4. Dunno.

5. Likely as in (3) I would think, but you'll probably want to grab the goods in GL3 anyways. I'd go for the clean slate with a fresh batch of procs per version/context.

M/\dm/\n

02-28-2009, 09:17 AM

Well, all this thing looks even nastier than I thought. The only thing that is available is OpenGL 3.0 spec and GLSL 1.3 spec. They are full of glBegin sort of stuff that is not even supported in forward compatible context.
All functions seem to be deprecated and the only way to specify vertices seems to be through VBO.

Matrix functions are gone, and there are no built in functions to perform any sort of matrix manipulation.

Ok, I'm not scared as of yet, as I know the math behind matrix algebra and I've done some GLSL 1.1 + VBO + FBO stuff, but OpenGL is far from newbie friendly now.

Right now I need to reread VBO specs, reimplement matrix algebra for projection and translation stuff, find where is the old quaternion classes I used before, recheck the GLSL syntax and all of this to draw a triangle.

Crazy...

Rob Barris

02-28-2009, 09:30 AM

Remember, in 3.0 everything is still there. Deprecated only means it could be removed in a future version context (which your app would have to explicitly request once available). You can continue to use the deprecated functions in a 3.0 context.

M/\dm/\n

02-28-2009, 09:54 AM

Well, as far as I understand, not if you use FORWARD_COMPATIBLE flag.

And you will have to switch to new functions eventually, it's better to do than now rather than later. Which isn't newbie friendly like the GL used to be compared to DX.

Rob Barris

02-28-2009, 05:09 PM

That's correct, if you request forward compatible then you have to restrict yourself to the non deprecated core features.

If you're a true beginner then you may not need the feature set of 3.1 or higher and 3.0 could be the right place to start. The thing to keep in mind is that no one is being forced to go to the higher versions until they are ready to do so.

Your POV may be that you want to start using the newer functions (avoiding deprecated functionality) sooner rather than later, and that is your choice to make. However it is not a choice that is forced upon anyone.