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 14

Thread: General question about OpenGL versions

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    10

    Question General question about OpenGL versions

    Hi,

    I would like to ask what version of OpenGL I should use when creating multiplatform renderer working also with software OpenGL implementations. It should run on windows(GDI), mac os x and on linux(MESA) as well.

    Is there any subset of commands that will work everywhere? My quess is that OpenGL 1.1 is the way to go as it should work on each OpenGL implementation. But what if I needed some feature available only via GLSL? Is mixing of OpenGL versions possible (I mean OpenGL 1.1 with higher ones)?

    I do not want to end up with coding as many renderers as there are OpenGL versions.

    Any help or clarification would be much appreciated.

    Thanks in advance.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,129
    I do not want to end up with coding as many renderers as there are OpenGL versions.
    Well if that's the case, why don't you settle for a GL3 or GL4 render path? Software implementations are good for two things:

    a) you want to be able to use OpenGL on hardware that doesn't support it (or doesn't support the version you need)
    b) you need sort of a ground-truth reference implementation against which other implementations are measured

    However, why would you want to code for hardware that's not at least GL 3.1 capable? Any Sandy Bridge and later laptop out there and any 2008 and later GPU by NVIDIA and AMD support GL3.

    The question you should be asking yourself isn't how to be as compatible to as much hardware as possible, subsequently and inevitably forcing you to reduce the maximum GL version, or worse, forcing you to implement two paths for programmable and non-programmable hardware - it should be "what is my target audience". If you write new code there is absolutely no reason not to go modern OpenGL, i.e. core GL 3.1 or higher.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    10
    Thank you thokra for the reply.

    If I got it right, almost every graphics card/driver should be able to run OpenGL v3.1. No matter what OS.

    Knowing this I may end up with two renderers:

    OpenGL 3.1 with fallback to OpenGL 1.1 (it is required because of Microsoft GDI does not support higher OpenGL versions).

    This approach should minimize my efforts.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,129
    If I got it right, almost every graphics card/driver should be able to run OpenGL v3.1
    No I didn't say that. What platforms do you want to support? Who is your target audience? What is the purpose of your application?

    OpenGL 3.1 with fallback to OpenGL 1.1
    Are you aware what that entails? Are you aware of how incredibly limited a GL 1.1 renderer has to be? Do you realize that you would be forced to throw away most of what the GL 3.1+ render path offers?

  5. #5
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    783
    Quote Originally Posted by thokra View Post
    Who is your target audience? What is the purpose of your application?
    I agree, this is a key design question you should sort out before deciding rendering paths.

    For OSX, take a quick look at the OpenGL capabilities table across OS versions.
    If you decide that you only care about supporting Macs capable of running 10.9 (a wise decision, IMHO) then you only have two baselines to deal with, GL3.3 and GL4.1. But go back to 10.7, and you'll have to deal with a wider range, including the GMA 950 which only supports GL1.4 (plus an assortment of newer features like GLSL, FBOs, VBOs, geometry shader, etc. But not float textures, MRT, integer formats, etc etc.)

    For other platforms, you might check stats collected by other companies, like Valve or Unity. That might give you a feel for the range of hardware your customers have.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,129
    Quote Originally Posted by arekkusu
    [..]or Unity.
    Thanks for this! Didn't know they had stats like that too. Very interesting. What's actually a bit troubling is the share Windows XP still holds - and that there even has been an increase up until 07/2013.

  7. #7
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    10
    I would like to support MAC OS X 10.9, Windows since Win XP and Latest linux distributions.

    I am aware that having two renderers is not good, but I am affraid I have no other way if I want to support Microsoft GDI (default software OpenGL on Windows). Not sure how about MESA on linux, but I think it is already capable of GL 3.1.

    Let me ask another question. There are only OpenGL 1.1 headers on Windows. If I want to use GL of higher versions, how do I do it? Yes, I know about GLEW, but I would rather not use it. What should I do? Download latest headers and use only features available on the platform?

  8. #8
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,129
    Not sure how about MESA on linux, but I think it is already capable of GL 3.1.
    AFAIK, the softpipe is still stuck at GL 2.1 - last I tested with 14.04 it still was. But then again, with Ubuntu 13.10 and later you get at least GL 3.1 compliance across all relevant open-source drivers (nouveau, radeon, intel), depending on the hardware capabilities, of course. If you go bleeding edge, you "even" get GL 3.3 compliance for those. Proprietary drivers are way above that anyway, if the hardware permits. At max, NVIDIA provides a GL 4.4 beta driver and AMD currently offers GL 4.3 compliance.

    There are only OpenGL 1.1 headers on Windows.
    Headers only describe interfaces and say nothing about what the implementation used by the OS is actually capable of. What is done on Windows is that a driver registers itself (in the registry, what a coincidence), and is automatically loaded by the OS. I'm not aware of any way to suppress redirection to the implementation provided by an IHV like NVIDIA, AMD or Intel (With MESA, for instance, you can set an environment variable to explicitly state that you don't want the vendor-specific driver to be used, but the softpipe). Then again, it wouldn't make much sense because if you write a GL3 application and decide that you want everything to be rendered by a software-implementation, on Windows you're out of luck.

    If I want to use GL of higher versions, how do I do it?
    To the user, the process is quite simple. As soon as the corresponding DLL (or shared object, or dylib) containing the implementation is loaded, you use the platform specific mechanism to retrieve pointers to functions said module, for instance wglGetProcAddress on Windows or the Linux equivalent, glXGetProcAddress. Essentially, this is what GL functions loaders like GLEW boil down to. They do handle a lot of other stuff but to get to GL functionality, getting a valid function pointer is all you need. Be aware that the above functions will return a nullptr if there is no current GL context in the thread from which they are called.

    What you as a programmer need to do is use such a loader or write the loading code by hand (pro tip: use the first variant to preserve your sanity). What you need to expect from the user is that a recent driver for their graphics card be installed. The rest is usually handled by the respective operating system.

    Download latest headers and use only features available on the platform?
    Ready-to-use loaders liker GLEW either provide an updated header already or some loader generators, like glLoadGen, generate the loading code for you as requested. For instance, GLEW generally provides compatibility and core support for every GL version up until GL 4.4 - glLoadGen lets you generate a header for core, compat, for a specific version and possibly with additional extension interfaces, which is a very neat and powerful solution.
    Last edited by thokra; 02-14-2014 at 06:49 AM.

  9. #9
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    10
    Thanks thokra,

    your comments are very helpful to me. I will probably use glLoadGen to generate OpenGL 3.1 headers and start with OpenGL 3.1. OpenGL implementations that do not comply to OpenGL 3.1 will fallback to my OpenGL 1.1 renderer (that already exists).
    I think it is the reasonable way.

    Thank you very much.

  10. #10
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,129
    that already exists
    You could have mentioned this a little earlier, don't you think? Did I overlook it?

Posting Permissions

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