help: OpenGL/GLSL v2.10/v1.10 -- to -- v3.20/v1.50

Started by
25 comments, last by maxgpgpu 14 years, 3 months ago
Quote:Original post by idinev
I just didn't need to set that bit :) . I only need core-profile (moving my 2.1 stuff to 3.1 was quick and painless, moving to 3.2 took 5 minutes).

There's "forward compatibility" and "backward compatibility". Probably you don't need the forward-compatibility, replace it with 0.
Since my code works in compatibility mode but not core mode, is there an easy way to make it list (or generate errors on) the functions I should not be calling? That sure would make it easier to figure out where are the places I need to upgrade.

One thing I see is... I need to remove where I set the MODELVIEW and PROJECTION matrix. Presumably I'm supposed to multiply those on the CPU and put a single matrix into the GPU as a uniform matrix, huh? Or I suppose I could put those two matrices into a uniform block and have the GPU do the multiply. I assume I just need to mat4x4 singlemat = modelviewmat * projectionmat; or something like that.

[Edited by - maxgpgpu on January 4, 2010 10:51:09 PM]
Advertisement
Just check with glGetError.
I.e when I use core 3.2 in forward-compatible mode, if I try to draw wide lines, glGetError screams. Also, keep a Radeon HDxxxx at hand, to test against unforgiving OpenGL implementations.

About the matrices, yes - compute on cpu with any maths lib you like. Uploading the matrices can be done in many ways. Just get the things up and running with simple glUniformMatrixXX calls, optimizations can wait (need usage-scenario tuning, are not a single-path). In most places a premultiplied MVP is better, but not really a must-have imho. (Mat4 MVP = projectionmat * modelviewmat; )
idinev:
How do I tell whether my application is fully updated to OpenGL/GLSL v3.20/v1.50 ???

After making lots of changes in OpenGL and GLSL, I changed my GLSL shaders:

  from#version 150 compatibility   to#version 150 core
and the application still runs and everything looks the same.

This makes me fairly confident my shaders are updated (except for trying named uniform blocks).

But is my main application updated to v3.20 or not? How do I tell? By setting different values in the attribs[] array before calling wglCreateContextAttribsARB() - as follows? The application seems to run correctly with the following settings.

  int attribs[] = {    WGL_CONTEXT_MAJOR_VERSION_ARB, 3,    WGL_CONTEXT_MINOR_VERSION_ARB, 2,//  WGL_CONTEXT_FLAGS_ARB, 0,                                                // support deprecated features    WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,           // do NOT support "deprecated" features    WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, // what does this mean ???  exactly what is a "profile"//  WGL_CONTEXT_PROFILE_MASK_ARB, 0,                                         // what does this mean ???  exactly what is a "profile"    0, 0  };


When I'm sure everything is "core" OpenGL v3.20 and GLSL v1.50, then I'll add a named uniform block (and uniform buffer object) for all uniform variables, and I'll try to make the VAO work. I guess apps with IBOs and VBOs are still valid without VAOs in the current versions --- and maybe all future versions too?
Quote:what does this mean ??? exactly what is a "profile"

You can read that in OpenGL 3.2 specification Appendix E titled "Core and Compatibility Profiles".
Basically 3.2 Core profile = new 3.2 features + forward compatible 3.1 features
3.2 Compatibility profile = new 3.2 features + 3.1 features + ARB_compatiblity extension.
Quote:Original post by bubu LV
Quote:what does this mean ??? exactly what is a "profile"

You can read that in OpenGL 3.2 specification Appendix E titled "Core and Compatibility Profiles".
Basically 3.2 Core profile = new 3.2 features + forward compatible 3.1 features
3.2 Compatibility profile = new 3.2 features + 3.1 features + ARB_compatiblity extension.

What is a "forward compatible v3.10 feature"?

Did v3.20 drop any features that were in v3.10?

PS: I read those pages twice, and still I'm confused.
Compatibility Profile = Add support for features that have been dropped from the core specification entirely.

Forward Compatible = Drop support for deprecated features that have not yet been dropped from core. This is really mostly relevant if you're using a 3.0 context, since I believe all deprecated features have been dropped by 3.2. Couldn't hurt though.

This will force OpenGL to use a core 3.2 profile with absolutely no support for compatibility/deprecated features:
int glAttribs[] = {	WGL_CONTEXT_MAJOR_VERSION_ARB, 3,	WGL_CONTEXT_MINOR_VERSION_ARB, 2,	WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,	WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,	0};
If everything still works in a context made with that, congratulations, you have good OpenGL 3.2 code.

OpenGL should set its error mode if you try to use a feature that isn't supported; the way I do things in my own code is to use a debug assertion at the end of every single function that calls to OpenGL. If you're doing something wrong, it'll be pretty obvious where that way.
Thanks to idinev, shrinkage and others my application appears to be pure core OpenGL v3.20 and GLSL v1.50 compliant. Wheee! Like almost everything else, after you know what is involved, it doesn't seem so difficult. Like almost everything else, before you know what is involved, it seems quite obscure.

Next:

#1: put matrices, lights and all other uniform variables (except samplers) into a (layout std140) uniform block.

#2: speed up my IBO/VBO code with one VAO (or one VAO per VBO).

To anyone going through the same upgrade hassle, contact me via this thread or PM and I'll try to list everything I had to change to update from OpenGL/GLSL v2.10/v1.10 to v3.20/v1.50 - which should yield nicely to a windiff on the "before" and "after" versions.

Thanks again guru helpers.

This topic is closed to new replies.

Advertisement