PDA

View Full Version : problem in uderstanding some basic concepts



Silent lamb
11-30-2012, 04:26 AM
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 ?

Aleksandar
11-30-2012, 04:12 PM
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.


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.


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 (http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt).

Silent lamb
11-30-2012, 09:44 PM
Thank you very much for the explanations


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 (http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt).

I was told about Proper Context Creation in the tutorial Creating an OpenGL Context (http://www.opengl.org/wiki/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.

V-man
12-01-2012, 06:17 AM
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:_OpenGL_3.0_Context_Creation_%28GLX%29

Silent lamb
12-01-2012, 11:55 PM
Thank you very much for your explanation!


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 (http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt).

The "Proper Context Creation" is introduced in the tutorial Creating an OpenGL Context (http://www.opengl.org/wiki/Creating_an_OpenGL_Context), now I see that "Proper Context" is GL 3+ context like you said.

mbentrup
12-02-2012, 03:08 AM
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 (http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt).

You can create OpenGL 3+ contexts with wglCreateContext, you just can't specify a minimum version or select a non-compatibility profile.