Sign in to follow this  
Followers 0
AutoBot

OpenGL
Difference between OpenGL 2.1 and 3.0?

6 posts in this topic

[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! :)[/color]
0

Share this post


Link to post
Share on other sites
You can freely download [url="http://www.opengl.org/documentation/specs/"]OpenGL specifications[/url]. 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.
1

Share this post


Link to post
Share on other sites
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:
[url="http://arcsynthesis.org/gltut/"]Learning Modern 3D Graphics Programming Through OpenGL[/url]
1

Share this post


Link to post
Share on other sites
[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 [i]how[/i] to write these theoretical "graphics wrappers"... Also, what are fixed functions? Do they basically manipulate the graphics pipeline?[/color]
0

Share this post


Link to post
Share on other sites
[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]
[color="#333333"][/quote][/color]
[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]
[color="#333333"][quote][/color]
[color="#333333"]Also, what are fixed functions? Do they basically manipulate the graphics pipeline?[/color]
[/quote]

NicoG meant "fixed-function" (i.e. non-programmable) pipeline.
1

Share this post


Link to post
Share on other sites
[quote name='AutoBot' timestamp='1312673718' post='4845603']
[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 [i]how[/i] to write these theoretical "graphics wrappers"... Also, what are fixed functions? Do they basically manipulate the graphics pipeline?[/color]
[/quote]

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++:


[code]

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;
}

[/code]
1

Share this post


Link to post
Share on other sites
[quote name='capricorn' timestamp='1312674166' post='4845604']
[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]
[color="#333333"][/quote][/color]
[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]
[/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.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • By recp
      Hi,
      I'm working on new asset importer (https://github.com/recp/assetkit) based on COLLADA specs, the question is not about COLLADA directly
      also I'm working on a new renderer to render (https://github.com/recp/libgk) imported document.
      In the future I'll spend more time on this renderer of course, currently rendering imported (implemented parts) is enough for me
      assetkit imports COLLADA document (it will support glTF too),
      importing scene, geometries, effects/materials, 2d textures and rendering them seems working
      My actual confusion is about shaders. COLLADA has COMMON profile and GLSL... profiles,
      GLSL profile provides shaders for effects so I don't need to wory about them just compile, link, group them before render

      The problem occours in COMMON profile because I need to write shaders,
      Actually I wrote them for basic matrials and another version for 2d texture
      I would like to create multiple program but I am not sure how to split this this shader into smaller ones,

      Basic material version (only colors):
      https://github.com/recp/libgk/blob/master/src/default/shader/gk_default.frag
      Texture version:
      https://gist.github.com/recp/b0368c74c35d9d6912f524624bfbf5a3
      I used subroutines to bind materials, actually I liked it,
      In scene graph every node can have different program, and it switches between them if parentNode->program != node->program
      (I'll do scene graph optimizations e.g.  view frustum culling, grouping shaders... later)

      I'm going to implement transparency but I'm considering to create separate shaders,
      because default shader is going to be branching hell
      I can't generate shader for every node because I don't know how many node can be exist, there is no limit.
      I don't know how to write a good uber-shader for different cases:

      Here material struct:
      struct Material { ColorOrTexture emission; ColorOrTexture ambient; ColorOrTexture specular; ColorOrTexture reflective; ColorOrTexture transparent; ColorOrTexture diffuse; float shininess; float reflectivEyety; float transparency; float indexOfRefraction; }; ColorOrTexture could be color or 2d texture, if there would be single colorOrTex then I could split into two programs,
      Also I'm going to implement transparency, I am not sure how many program that I needed

      I'm considering to maintain a few default shaders for COMMON profile,
      1-no-texture, 2-one of colorOrTexture contains texture, 3-........

      Any advices in general or about how to optimize/split (if I need) these shaders which I provied as link?
      What do you think the shaders I wrote, I would like to write them without branching if posible,
      I hope I don't need to write 50+ or 100+ shaders, and 100+ default programs

      PS: These default shaders should render any document, they are not specific, they are general purpose...
             I'm compiling and linking default shaders when app launched

      Thanks
    • By CircleOfLight97
      Hi guys,
      I would like to contribute to a game project as a developer (open source possibly). I have some experiences in C/C++ in game development (perso projects). I don't know either unreal or unity but I have some knowledges in opengl, glsl and shading theory as I had some courses at university regarding to that. I have some knowledges in maths and basic in physics. I know a little how to use blender to do modelling, texturing and simple game assets (no characters, no animation no skinning/rigging). I have no game preferences but I like aventure game, dungeon crawler, platformers, randomly generated things. I know these kind of projects involve a lot of time and I'd be really to work on it but if there are no cleary defined specific design goals/stories/gameplay mechanics I would like to not be part of it x) and I would rather prefer a smaller but well defined project to work on that a huge and not 'finishable' one.
      CircleOfLight97
    • By gamesthatcouldbeworse
      Hi, I finally released KILL COMMANDO on gamejolt for free. It is a retro-funsplatter-shooter with C64 style. Give it a try.
    • By phil67rpg

      void TimerFunction(int value) {  glutPostRedisplay();  glutTimerFunc(1000, TimerFunction, 1); } void drawScene() {  glClear(GL_COLOR_BUFFER_BIT);      drawScene_bug();  TimerFunction(1);  eraseScene_bug(); // drawScene_bug_two(); // eraseScene_bug_two(); drawScene_ship(); drawScene_bullet();  glutSwapBuffers(); }