Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: OpenGL Version?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2012
    Posts
    1

    OpenGL Version?

    Hiya,

    Coming from Direct3D, I decided to make a simple 3D game a while back in OpenGL. The tutorials I used were (I believe) in OpenGL 1.0, using the immediate-mode fixed-function pipeline... glBegin(), glVertex..(), glEnd() etc. I'd like to remake the game using a more recent and applicable version of OpenGL, and I have a few questions I was hoping someone could help with.

    From what I've read, it looks like OpenGL 3 'core profile' is the version I need. Is there any way for an application to request this version of the API specifically? Or will the driver provide everything it has, and the application should limit itself to only using 3.0 functions? If the latter case, how should an application check whether 3.0 is indeed supported?

    On a related point, is it possible for an application to only use functions which are common to both 2.1 and 3?

    I'm really looking for a way to support DX9-era hardware if possible, while using the most modern API I can.

    Any advice appreciated.

    Cheers!
    Jim

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421
    Quote Originally Posted by telios View Post
    Hiya,

    Coming from Direct3D, I decided to make a simple 3D game a while back in OpenGL. The tutorials I used were (I believe) in OpenGL 1.0, using the immediate-mode fixed-function pipeline... glBegin(), glVertex..(), glEnd() etc. I'd like to remake the game using a more recent and applicable version of OpenGL, and I have a few questions I was hoping someone could help with.

    From what I've read, it looks like OpenGL 3 'core profile' is the version I need. Is there any way for an application to request this version of the API specifically? Or will the driver provide everything it has, and the application should limit itself to only using 3.0 functions? If the latter case, how should an application check whether 3.0 is indeed supported?

    On a related point, is it possible for an application to only use functions which are common to both 2.1 and 3?

    I'm really looking for a way to support DX9-era hardware if possible, while using the most modern API I can.

    Any advice appreciated.

    Cheers!
    Jim
    Yes, that would be GL 1.0 (actually, 1.1 was available everywhere).
    The GL version depends on two things : the GPU and the up to date driver.
    For DX9 GPUs, go with GL 2.0. Use shaders for everything. Use VBO for everything. Yes, you can restrict yourself in GL 2 so that porting to upper versions becomes easy.
    If you are interested in GL 3.0, why don't you aim for 3.3? It is available on all DX10 GPUs.

    http://www.opengl.org/wiki/FAQ

    and some tutorials
    http://www.opengl.org/wiki/Tutorials
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    941
    Quote Originally Posted by telios View Post
    Is there any way for an application to request this version of the API specifically?
    Yes, read http://www.opengl.org/registry/specs...te_context.txt.

    Quote Originally Posted by telios View Post
    Or will the driver provide everything it has, and the application should limit itself to only using 3.0 functions?
    By default, it will, as a compatibility profile context also contains all the core profile feature, however it is cleaner if you use a core profile instead.

    Quote Originally Posted by telios View Post
    On a related point, is it possible for an application to only use functions which are common to both 2.1 and 3?
    There is no way to create a version 2.1 core profile context. However, you can limit yourself by using only core features.

    If you take my advice, you should work on a DX10 class hardware using an OpenGL 3.3 core profile context (or 3.2 if you want to support MacOSX too) and make it work there. After that, you can "port it back" to 2.1 in favor of DX9 class hardware. Most likely you don't need any changes to do so, unless you use some DX10 hardware specific features like geometry shaders or separate blend equations, etc. But as your code worked perfectly fine using GL 1.1, I suppose you don't need those anyway.

    However, you can freely use those GL3/4 features that don't require any special hardware (if they are available) like VAOs (actually, in GL 3 core profile it is a must to use them).
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

Posting Permissions

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