PDA

View Full Version : OpenGL Version?



telios
06-11-2012, 02:37 AM
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

V-man
06-11-2012, 04:59 AM
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

aqnuep
06-11-2012, 08:52 AM
Is there any way for an application to request this version of the API specifically?
Yes, read http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt.


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.


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).