• Create Account

## Difference between OpenGL 2.1 and 3.0?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

6 replies to this topic

### #1AutoBot  Members

109
Like
0Likes
Like

Posted 06 August 2011 - 03:46 PM

This aspect has been bothering me for a while now: what are the differences I need to be aware of between OpenGL 2.1 and 3.0? I do know that 3 introduces a deprecation mechanism, but what types of functions have been deprecated? I'd like to know this so that I can look for OpenGL resources without having to be worried about whether a certain feature/practice is "deprecated" or not. I also don't really want to run away from tuts that use OGL 2 if there's still valuable information that applies to OpenGL in general.
Another thing I'm wondering about is how I can present newer OGL 3+ projects on older PCs that don't support it. What compatibility methods should I use to get the most benefits out of 3.0+ while still maintaining compatibility with older systems? Or will I have to resort to finding a capable PC to present my applications?

### #2capricorn  Members

139
Like
1Likes
Like

Posted 06 August 2011 - 04:17 PM

You can freely download OpenGL specifications. Each GL3.0+ spec contains a section on deprecation which lists deprecated and already removed features.

Generally, to maintain compatibility with older GL you'll have to either disable some features of your application that rely on modern GL functionality or create additional implementation of those in terms of older GL version. For example, GL3+ code would use VAOs, while code for 2.1 would have to stick with manual vertex layout specification. This example is almost harmless, but in general such quirks can quickly saturate your maintenance effort, so you should think twice if you really need it. I'm not even mentioning shaders and GLSL version support

Furthermore, your initialization code will have to be written so that it creates proper context. Also you'll have to choose whether or not to rely on compatibility profile when writing modern GL code (i.e. using deprecated features). Currently, compatibility profile seems to be available for both nVidia and AMD, but the spec does not require that drivers provide it.
WBW, capricorn

### #3GothSeiDank  Members

172
Like
1Likes
Like

Posted 06 August 2011 - 04:39 PM

The main difference in 3.0 is, that all fixed functions are gone. No more glMultMatrix, glLoadMatrix etc.
You have to do that with shaders.
GLM is a library that helps here, since it is written against the glsl spec and can dirctly be transmitted to the shader.
It also provides a replacement of glOrtho and glFrustum etc.
Have a look here:
Learning Modern 3D Graphics Programming Through OpenGL
If you say "pls", because it is shorter than "please", I will say "no", because it is shorter than "yes"
http://nightlight2d.de/

### #4AutoBot  Members

109
Like
0Likes
Like

Posted 06 August 2011 - 05:35 PM

I'm starting to like the idea of having different rendering configurations (disabling unsupported features according to system specs). I could make some graphics wrappers and use those to encapsulate various collections of dynamic libraries (holding the platform-specific functionality), depending on the OGL version supported. That way my code will be lighter and I can leave it to an installer to provide the correct libraries depending on the system specs.

This might be a bit more work, but it does give me a better perspective of how I should manage the platform-specific code. I suppose the real question is how to write these theoretical "graphics wrappers"... Also, what are fixed functions? Do they basically manipulate the graphics pipeline?

### #5capricorn  Members

139
Like
1Likes
Like

Posted 06 August 2011 - 05:42 PM

This might be a bit more work, but it does give me a better perspective of how I should manage the platform-specific code. I suppose the real question is how to write these theoretical "graphics wrappers"...

Trust me, as soon as you start digging into it, you'll see that this "a bit more work" will turn into "a lot of pain"

Also, what are fixed functions? Do they basically manipulate the graphics pipeline?

NicoG meant "fixed-function" (i.e. non-programmable) pipeline.
WBW, capricorn

### #6GothSeiDank  Members

172
Like
1Likes
Like

Posted 06 August 2011 - 05:56 PM

I'm starting to like the idea of having different rendering configurations (disabling unsupported features according to system specs). I could make some graphics wrappers and use those to encapsulate various collections of dynamic libraries (holding the platform-specific functionality), depending on the OGL version supported. That way my code will be lighter and I can leave it to an installer to provide the correct libraries depending on the system specs.

This might be a bit more work, but it does give me a better perspective of how I should manage the platform-specific code. I suppose the real question is how to write these theoretical "graphics wrappers"... Also, what are fixed functions? Do they basically manipulate the graphics pipeline?

Fixed Functions is the non-programmable pipeline in OpenGL. As I said it is functions like glMultMatrix, glMatrixMode etc.

If you want the same code with 2 different backends, use the pimpl-idiom.
Like this, assuming C++:


class OpenGL
{
public:
virtual void draw_something()
{}
};

class OpenGL2 : public OpenGL
{
public:
virtual void draw_something() {}
};

class OpenGL3 : public OpenGL
{
public:
virtual void draw_something() {}
};

class FrontendAPI
{
public:
FrontendAPI(int OpenGLVersion)
{
if ( OpenGLVersion == 2 )
{
m_impl = new OpenGL2();
}
else if ( OpenGLVersion == 3 )
{
m_impl = new OpenGL3();
}
};

void draw_something()
{
m_impl->draw_something();
}

private:
OpenGL* m_impl;
}



If you say "pls", because it is shorter than "please", I will say "no", because it is shorter than "yes"
http://nightlight2d.de/

### #7AutoBot  Members

109
Like
0Likes
Like

Posted 06 August 2011 - 09:47 PM

This might be a bit more work, but it does give me a better perspective of how I should manage the platform-specific code. I suppose the real question is how to write these theoretical "graphics wrappers"...

Trust me, as soon as you start digging into it, you'll see that this "a bit more work" will turn into "a lot of pain"

Yeah I suppose it can't be too easy to do it. Then again NicoG represented a good implementation that may make the pains a bit easier. I'll look into doing either that or just starting from 2.1 and adding stuff from there. I guess it's still good to get into the multiplatform stuff though.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.