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 6 of 6

Thread: problem in uderstanding some basic concepts

  1. #1
    Newbie Newbie
    Join Date
    Nov 2012
    Posts
    3

    Question problem in uderstanding some basic concepts

    Hello! I'm just getting start with OpenGL, I read some articles about OpenGL on the website, but still have some questions. I hope you can help me to figure out.

    1. What determines my OpenGL version? Is it that OpenGL functions come with Graphics card drivers ?
    Can I change my OpenGL version by just doing something like installing some drivers on my computer ?

    2. Why do I have to call *GetProcAddress to get the address of functions of extensions, where are the functions' binaries? Is GLEW simply a function loader ? How dose it load functions for me ?

    3. I read the article about creating a OpenGL context, and feel a little confused about the Proper Context Creation. I'm not sure about what the advantages are of using WGL extension functions to create a context. Is it because functions like wglCreateContextAttribsARB supports extensible attributes for an OpenGL context ?
    Where can I get detailed descriptions about those attributes ?

  2. #2
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,158
    Quote Originally Posted by Silent lamb View Post
    1. What determines my OpenGL version? Is it that OpenGL functions come with Graphics card drivers ?
    Can I change my OpenGL version by just doing something like installing some drivers on my computer ?
    Yes, OpenGL functionality is embedded into graphics card driver. You can change OpenGL version by installing different versions of drivers, but it is also limited with the hardware capabilities. For example, you cannot use OpenGL 4.0 functionality if your hardware does not support it.

    Quote Originally Posted by Silent lamb View Post
    2. Why do I have to call *GetProcAddress to get the address of functions of extensions, where are the functions' binaries? Is GLEW simply a function loader ? How dose it load functions for me ?
    It is an excellent mechanism that has been working for two decades. As already said in the previous answer, the functions are built in drivers.
    Yes, GLEW is simply an extension loader/wrapper. It is an open source solution, so you can check by yourself how it is implemented.

    Quote Originally Posted by Silent lamb View Post
    3. I read the article about creating a OpenGL context, and feel a little confused about the Proper Context Creation. I'm not sure about what the advantages are of using WGL extension functions to create a context. Is it because functions like wglCreateContextAttribsARB supports extensible attributes for an OpenGL context ? Where can I get detailed descriptions about those attributes ?
    I'm not sure what is the meaning of "Proper Context Creation". There is no advantage of using extensions to make a context; you simply DON'T HAVE an alternative for making GL 3+ context. By using wglCreateContext() only a GL 2.1 context can be made. But it is necessary in order to call wglCreateContextAttribsARB(). Details about context creation and appropriate attributes can be found here.

  3. #3
    Newbie Newbie
    Join Date
    Nov 2012
    Posts
    3
    Thank you very much for the explanations
    Quote Originally Posted by Aleksandar View Post
    I'm not sure what is the meaning of "Proper Context Creation". There is no advantage of using extensions to make a context; you simply DON'T HAVE an alternative for making GL 3+ context. By using wglCreateContext() only a GL 2.1 context can be made. But it is necessary in order to call wglCreateContextAttribsARB(). Details about context creation and appropriate attributes can be found here.
    I was told about Proper Context Creation in the tutorial Creating an OpenGL Context, which suggest that I should first call ChoosePixelFormat, SetPixelFormat and wglCreateContext to ceate a false context, so that we can get functions(like wglChoosePixelFormatARB and wglCreateContextAttribsARB) we needed to create a proper context. So I guess the "Proper Context Creation" is creating a GL 3+ context like what you said.

  4. #4
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,264
    Yes, that is correct. In order to get function pointers to the new functions, you need to have a GL context. There is no choice but to create an old style context first.
    The same idea applies for creating a GL3 context and also a multisampled surface.

    You can also search for tutorials on the Wiki
    This is one example
    http://www.opengl.org/wiki/Tutorial:...tion_%28GLX%29
    ------------------------------
    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);

  5. #5
    Newbie Newbie
    Join Date
    Nov 2012
    Posts
    3
    Thank you very much for your explanation!
    Quote Originally Posted by Aleksandar View Post
    I'm not sure what is the meaning of "Proper Context Creation". There is no advantage of using extensions to make a context; you simply DON'T HAVE an alternative for making GL 3+ context. By using wglCreateContext() only a GL 2.1 context can be made. But it is necessary in order to call wglCreateContextAttribsARB(). Details about context creation and appropriate attributes can be found here.
    The "Proper Context Creation" is introduced in the tutorial Creating an OpenGL Context, now I see that "Proper Context" is GL 3+ context like you said.

  6. #6
    Junior Member Regular Contributor
    Join Date
    Dec 2009
    Posts
    212
    Quote Originally Posted by Aleksandar View Post
    I'm not sure what is the meaning of "Proper Context Creation". There is no advantage of using extensions to make a context; you simply DON'T HAVE an alternative for making GL 3+ context. By using wglCreateContext() only a GL 2.1 context can be made. But it is necessary in order to call wglCreateContextAttribsARB(). Details about context creation and appropriate attributes can be found here.
    You can create OpenGL 3+ contexts with wglCreateContext, you just can't specify a minimum version or select a non-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
  •