Difference between OpenGL 2.1 and 3.0?

Started by
5 comments, last by AutoBot 12 years, 8 months ago
[color=#333333]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?

Thanks for any advice! :)
Advertisement
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
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.
capricorn already pointed out VBOs.
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/
[color="#333333"]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?

[color="#333333"]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"...
[color="#333333"]

[color="#333333"]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" :)
[color="#333333"]

[color="#333333"]Also, what are fixed functions? Do they basically manipulate the graphics pipeline?
[/quote]

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

[color="#333333"]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.

On your other problem:
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/

[quote name='AutoBot' timestamp='1312673718' post='4845603']
[color="#333333"]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"...
[color="#333333"]

[color="#333333"]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" :)
[/quote]

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.

This topic is closed to new replies.

Advertisement