PDA

View Full Version : using opengl 3.x stuff in opengl 2.1 ??



lobbel
10-22-2010, 01:33 PM
Hello,
currently I'm working with OpenGL 3.3 and I was wondering If can use new features from version 3.3 in OpenGL 2.1 ?

As you know, you can use vertex attributes and declare them like semantics (as used in nvidia cg).

example:


#version 330
#define ATTR_POSITION 0
layout(location = ATTR_POSITION) in vec3 gs_Vertex;


Do I need a 3.3 context created to use this new features or are they loaded by extensions and mark the GLSL version at the
first line of shaders ?

regards,
lobbel

Alfonse Reinheart
10-22-2010, 02:19 PM
Do I need a 3.3 context created to use this new features or are they loaded by extensions and mark the GLSL version at the
first line of shaders ?

You can use many higher features by extension name. For example, this functionality is provided by GL_ARB_explicit_attrib_location. So you can use the #extension syntax to use that with a version pre-version 1.50 shader.

For that feature, there is some reason to use it with pre-3.x shaders. It is not a hardware-based feature. There's less reason to do so with hardware-based features like UBOs, etc. Not unless you're developing on a Mac, and there you have to make due with EXT extensions, as Apple doesn't seem interested in supporting 2-year-old ARB extensions.

That being said, quite a lot of 2.1 hardware is no longer fully supported by IHVs. 3.x hardware has been available for 3+ years now, so the old stuff is being rotated off of support. So while a 2.1-limited implementation could support GL_ARB_explicit_attrib_location, it's entirely possible that they don't. According to the OpenGL extension viewer's database, the only 2.1-limited hardware that supports this extension are the GeForce 6600 and GeForce 7600. I think this probably means that all GeForce 6xxx and 7xxx would support it with recent drivers, but those are the only two entries in the database.

Take ARB_fragment_coord_conventions. This was an extension added in the 3.3 set (explicit attribute location was in the 3.2 set). It is only exposed in 3.x hardware, even though pre-3.x hardware must have been able to do it (the extension allows you to use Direct3D conventions instead of OpenGL conventions. Pre 3.x hardware must have been able to do both). This suggests that the pre-3.x GeForce hardware is out of support.

So use caution with this.

lobbel
10-22-2010, 02:43 PM
Thank you for this extensive explanation.
So I better keep focus on the newer versions.
Actually I wanted to mix the good things of both versions.
Like outline fonts. It's more difficult to create fonts in the
newer versions. I found an example that's doing this by shader works and a lot stuff around.

regards,
lobbel