Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Which OpenGL Version

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2015
    Posts
    7

    Question Which OpenGL Version

    I know OpenGL 2 has some if not almost all functions deprecated by OpenGL 3 thus making it the stay away versions as said by some OpenGL programmers. Currently though I only have a laptop which support OpenGL 2.1 but want to start on learning OpenGL. On some websites I have read that you could go and learn OpenGL 2 but then you would have to avoid/dodge on using those functions which are deprecated, problem is that I wouldn't know which is which when it comes to deprecated and not, even if I did, I'd say it would pretty much consume a considerable amount of time giving me more problems on learning the API and so back to the same question if I should learn 2 or not. Seeing that programs made using OpenGL 2 will then be hindered useless on modern software, learning OpenGL 2 then is as much as wasting your time. With this in mind how am I suppose to tackle my current situation while refraining(as much as possible) on buying new hardware.

    Also I have read that MesaGL on linux have their implementation of OpenGL to 3. If I'm not wrong Mesa3d is a driver on which can be used on either Intel, Nvidia, AMDs, please do correct me if I'm wrong. If so, can I use MesaGL to program for modern OpenGL then? Thanks in advance.

    By the way, is there any way of providing the deprecated functionalities in any means like providing the missing functionalities with some kind of files?
    Last edited by Preedne; 01-05-2015 at 07:13 PM. Reason: typo, added info

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,828
    Quote Originally Posted by Preedne View Post
    I know OpenGL 2 has some if not almost all functions deprecated by OpenGL 3
    So does OpenGL 3.0. OpenGL 3.1 actually removed the deprecated features (except that they were still available via the GL_ARB_compatibility extension). OpenGL 3.2 introduced profiles; the core profile lacks the deprecated features, the compatibility profile retains them.

    Quote Originally Posted by Preedne View Post
    Currently though I only have a laptop which support OpenGL 2.1 but want to start on learning OpenGL. On some websites I have read that you could go and learn OpenGL 2 but then you would have to avoid/dodge on using those functions which are deprecated, problem is that I wouldn't know which is which when it comes to deprecated and not, even if I did, I'd say it would pretty much consume a considerable amount of time giving me more problems on learning the API and so back to the same question if I should learn 2 or not.
    .
    I think so. IMHO, it's easier to learn OpenGL by using some of the deprecated features then stop using them once you're more familiar with the general concepts.

    The main problem with learning "modern" OpenGL from the outset is that you need to understand a number of features before you can get a single triangle on screen. Without the fixed function pipeline, you have to be able to write GLSL vertex and fragment shaders, compile and link them, and query (or set) uniform and attribute locations, set uniforms and bind attribute arrays. Without client-side arrays, you have to be able to create, allocate, populate and use buffer objects. Without the matrix operations, you have to either write your own matrix functions or use an additional library (which, depending upon the presence or absence of Murphy's Law, might add anywhere between 5 minutes and a day to the time taken to get your first program to even compile, let alone run).

    Once you're familiar with OpenGL, none of this is an issue. Compared to the complexity of any "real" program, the boilerplate involved is trivial. But it does mean that "hello, world" programs are significantly more complex when using the modern approach compared to the legacy approach.

    Quote Originally Posted by Preedne View Post
    Also I have read that Mesa3d on linux have their implementation of OpenGL to 3. If I'm not wrong Mesa3d is a driver on which can be used on either Intel, Nvidia, AMDs, please do correct me if I'm wrong. If so, can I use Mesa3d to program for modern OpenGL then?
    Mesa itself is up to 3.3, but many of the features require support from hardware. If your laptop only supports OpenGL 2, it may be because the video hardware isn't capable of some of the OpenGL 3 features.

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2015
    Posts
    7
    Thank you for the thorough reply. So if I got this right, then using the GL_ARB_compatibility extension for OpenGL 3.1 and using compatibility profile for OpenGL 3.2 would mean that programs running on OpenGL 2 would still run? If so, then I guess I would learn OpenGL as you and the others have said. OpenGL 2 first then modern OpenGL for speed and better effects.

  4. #4
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    6,008
    Here's my take on the subject.

    Is it more complex to learn in the beginning? In a certain sense, yes. But that is only in the sense is that you have to actually understand what's going on. You have to know that there's a rendering pipeline and that data flows from one end to the other.

    You are able to learn the FFP without actually having the slightest clue what it means. You can "learn" that glNormal associates normals with vertices. You can "learn" that glLight calls setup lights that act on the normals to create the effect of illumination. You can "learn" that glColor associates colors with vertices.

    But do you actually understand what's happening? Take what I just talked about: normals, colors, and lights. Does a person who learned these with FFP OpenGL truly understand it? Do they realize that lighting is done per-vertex? Do they understand why glColorMaterial is needed, and what it's doing internally? Do they understand the difference between "diffuse" and "specular" lighting, or do they just fiddle around with values until it looks "OK"? And so forth.

    Fixed-function OpenGL allows you to have the illusion of understanding, without the certain knowledge. You are allowed to think that you know more than you do, because it's simpler.

    And this kind of knowledge is not sophistry; it's crucial if you're really going to solve problems with OpenGL and graphics. Take the above knowledge, now add textures. Well... what does a texture really mean? If you don't understand how the per-vertex color really interacts with the lighting equation, how do you explain that a texture just allows you to vary that color on a per-fragment basis? Because it's that final understanding which is important in the world of shaders.

    It is possible to learn FFP OpenGL to a degree that you actually understand what's going on behind the scenes. But it will take far more time and effort. And much of this time and effort will be wasted.

    For example, I can explain the details and intricacies of glTexEnv in all of its myriad insanity. Is that knowledge of any value in a shader world? Was the time I spent learning it of use? Mostly, no. Oh, I learned about rasterization and fragments; that's useful. I learned about the interpolation of per-vertex outputs. But the specific details of the "texture environment" functions?

    Completely useless now.

    Furthermore, there's a lot of stuff that you can leave out of the early lessons. Uniforms are not needed in "hello world". You still have to do attributes, but there needs be no querying of them thanks to explicit attribute locations in GL 3.3. Buffer objects for vertex data are really just 3 extra function calls (and you can explain them as being nothing more than a GPU malloc. Which they are). So that takes care of lesson 1, which is the hardest part of shader-based GL.

    Once you get lesson 1 down, you can introduce each new concept as needed: uniforms, multiple attributes (along with vertex formats), etc.

    You can learn step-by-step with modern GL effectively. It will certainly be a front-loaded experience to an extent, one that requires that you gain an understanding of what's going on. As evidence is the partially complete book about learning modern OpenGL in my signature. It's up to you as to whether it does the job I say can be done.

    Of course, your main problem is that you lack a computer with GL 3.x capabilities. So... that makes it kind of a moot point for you.

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2015
    Posts
    7
    Thank you for giving your time on replying in this thread and explaining the whys. Reading your book introductory part I've got a sense that I would be able to finally understand this tutorial http://blogs.msdn.com/b/davrous/arch...avascript.aspx of which I was fiddling with for quite some time now and getting myself stucked at the device object. I've watched the video about the tutorial(only the 1st video as the other videos seem to be only talking about features and not on how 3d graphics engines work) and have been introduced with the maths, process of how things go with 3d graphics engines, like normals as you have said, though the video wasn't really that helpful to me, it gave me the basic of the basic in understanding the process going on under the codes. That said are there functions in OpenGL 2/2.1 thats similar to modern OpenGL I could use to start? I have read from some site that OpenGL 2(Old) have the functions modern OpenGL have. The transition from old to modern explained that OpenGL 3 was simply OpenGL 2 only striped off of the immediate ready to be applied functions plus the new features. If I were to study OpenGL 3 guidelines/tutorials/lessons will I be able to confidently apply it with OpenGL 2? I might sound like I'm actually thinking of compatibility issues here for future developments but again, I lack the hardware, even so maybe this is a good opportunity to expose me on how developers have their hard time figuring how to manage old hardware while still giving great technology. Never mind my last question... I realized that I might just hit the new features not available from the old OpenGL in the process... Another dead end.
    Last edited by Preedne; 01-05-2015 at 09:31 PM.

  6. #6
    Intern Contributor
    Join Date
    Oct 2014
    Posts
    55
    Just learn 2.1 then.

    Get a copy of OpenGL Superbible 4, it covers OpenGL 2.1 and is really not a bad book. It also introduces Shaders so it's not entirely outdated.

    After reading that book i'm pretty sure you'll be able to learn a newer version really fast once you get a better computer.

  7. #7
    Member Regular Contributor
    Join Date
    Dec 2009
    Posts
    251
    Quote Originally Posted by Preedne View Post
    That said are there functions in OpenGL 2/2.1 thats similar to modern OpenGL I could use to start? I have read from some site that OpenGL 2(Old) have the functions modern OpenGL have.
    In practice OpenGL 3.0 added very little new functionality over 2.1, because a lot of it was already available as common extensions to 2.1 (framebuffer object, floating point textures etc.), and OpenGL 3.1 is tricky to work with, because basically the driver can decide if your app gets a core or compatibility profile.

    So you can use 2.1 + common extensions in a way that is pretty close to OpenGL 3.0 or 3.1, if you avoid immediate mode, display lists, non-generic attributes. What you won't get in 2.1 are interpolation qualifiers and attribute-less rendering and there are some syntactic differences (e.g. use of "in/out" instead of "varying"), but those are not that important that you can't learn the more modern OpenGL concepts on 2.1. There are of course more things to learn in higher 3.x versions, like uniform buffer objects, but those can be learned later.

  8. #8
    Junior Member Newbie
    Join Date
    Jan 2015
    Posts
    7
    Just learn 2.1 then.

    Get a copy of OpenGL Superbible 4, it covers OpenGL 2.1 and is really not a bad book. It also introduces Shaders so it's not entirely outdated.

    After reading that book i'm pretty sure you'll be able to learn a newer version really fast once you get a better computer.
    Thanks for replying. I was thinking of doing so but wanna get some insights if it should really be learned since I'm having trouble deciding myself. Old and modern OpenGL are really far apart and deciding on which to invest time is getting me stuck. The way I see the two versions is that they're both different APIs and learning the other isn't going to help you learn both, but I really don't have a choice now since my hardware limits me so.

    I've given the book a brief reading and according to it there are two methods of doing things in OpenGL which I have also read from gamdev's stackexchange, the other currenly being deprecated and the other being currently used. He mentioned that immediate mode(deprecated) and retained mode(current) are both in OpenGL 2 as well as the fixed functionality and custom shaders. This leaves me the idea that it's okay to learn the old way as long as you use it to learn the modern way preparing for when you get the proper tool, in my case a good hardware. What I have understood so far is that OpenGL 2(old OpenGL) would introduce me to how things are arranged while also having a way to use a part of how things is modernly done. Then while learning OpenGL 3(modern OpenGL) would teach me how each things works rather than just arranging functionalities provided by the previous version of the API. Does that sum it all up?

    In practice OpenGL 3.0 added very little new functionality over 2.1, because a lot of it was already available as common extensions to 2.1 (framebuffer object, floating point textures etc.), and OpenGL 3.1 is tricky to work with, because basically the driver can decide if your app gets a core or compatibility profile.

    So you can use 2.1 + common extensions in a way that is pretty close to OpenGL 3.0 or 3.1, if you avoid immediate mode, display lists, non-generic attributes. What you won't get in 2.1 are interpolation qualifiers and attribute-less rendering and there are some syntactic differences (e.g. use of "in/out" instead of "varying"), but those are not that important that you can't learn the more modern OpenGL concepts on 2.1. There are of course more things to learn in higher 3.x versions, like uniform buffer objects, but those can be learned later.
    Thanks for the reply. So basically since the update of OpenGL to 3 most things done is the removal of functions and introduction of few new features? I guess I'll go learn OpenGL 2 while finding my way on doing it the modern way afterwards.
    Last edited by Preedne; 01-06-2015 at 07:34 AM.

  9. #9
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,214
    Programming in OpenGL 2.1 does not necessarily mean you are using the "old way". As others said, you have chance to learn the "modern way" with OpenGL 2.1 also. Just ensure the following:

    1. use VBO for all drawing,

    2. use shaders (the vertex and fragment shaders are still the main working horses),

    3. use glVertexAttribPointer() to specify attributes.

    If your drivers also support texture arrays, you have nothing to worry about. BTW, what GPU are you dealing with?
    I'm recommending you a book - OpenGL ES 2.0 Programming Guide. Although it is not for OpenGL, but for OpenGL ES, I think it is quite useful.

  10. #10
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,828
    Quote Originally Posted by Preedne View Post
    Thank you for the thorough reply. So if I got this right, then using the GL_ARB_compatibility extension for OpenGL 3.1 and using compatibility profile for OpenGL 3.2 would mean that programs running on OpenGL 2 would still run?
    Yes. The legacy API isn't going away; there's too much code which relies upon it.

    Not only that, but the compatibility profile for each version includes the newest features added in that version as well as all of the legacy API. So you can use features which were added in 4.5 alongside the fixed-function pipeline in the same program.

    However: not all implementations will offer the compatibility profile for the latest version. E.g. Apple's plan for OSX is that you'll be able to get a 4.x core profile (assuming the GPU supports it) or a 3.x compatibility profile, but not a 4.x compatibility profile.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •