OpenGL, Versions, and the Fixed-Function Pipeline

Started by
7 comments, last by jbizzler 16 years, 11 months ago
I'm just starting to look into the world of OpenGL. A couple of things confuse me. 1. How does the versioning work. It's not like with Direct3D where I download an SDK version. Right now, I'm just using the libraries in the Windows SDK. I know my graphics card supports OpenGL 2.0, but how do I tap into its features and such. Is it just a series of specifications, or do I need a new SDK? 2. I know the Direct3D world is getting rid of the fixed-function pipeline. Is the OpenGL community doing the same? I've noticed in all the tutorials I find, there's the PIXELFORMATDESCRIPTOR, with what looks like a lot of fixed-function settings. Is there a clean way to work around this, or should I just forget all those values? Is there any reason I should use it, and if I shouldn't, what are my guidelines for not doing so. 3. I've noticed the WGL stuff only works in WindowProc. Why is this? Is there a workaround? What if I set up an HDC and HGLRC, make them current, but never use them because my app also supports Direct3D. Would this hurt anything? Thanks for reading my post. I hope you can answer my questions.
Advertisement
Quote:Original post by jbizzler
I'm just starting to look into the world of OpenGL. A couple of things confuse me.

1. How does the versioning work. It's not like with Direct3D where I download an SDK version. Right now, I'm just using the libraries in the Windows SDK. I know my graphics card supports OpenGL 2.0, but how do I tap into its features and such. Is it just a series of specifications, or do I need a new SDK?

2. I know the Direct3D world is getting rid of the fixed-function pipeline. Is the OpenGL community doing the same? I've noticed in all the tutorials I find, there's the PIXELFORMATDESCRIPTOR, with what looks like a lot of fixed-function settings. Is there a clean way to work around this, or should I just forget all those values? Is there any reason I should use it, and if I shouldn't, what are my guidelines for not doing so.

3. I've noticed the WGL stuff only works in WindowProc. Why is this? Is there a workaround? What if I set up an HDC and HGLRC, make them current, but never use them because my app also supports Direct3D. Would this hurt anything?

Thanks for reading my post. I hope you can answer my questions.


1) You can just use extensions.

2) AFAIK OpenGL:ES 2.0 doesn't support the old fixed function pipeline.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
A little more info on point #2:

Both OpenGL|ES and "Desktop" OpenGL are moving away from the fixed-function pipeline. There are future plans to provide a "lean and mean" version of OpenGL which will basically mirror the hardware implimentation of 3D hardware, with the old fixed-function model moving into an optional software layer. Other examples of things that are to be moved include Quad and Polygon primitives, for instance.


Basically, OpenGL is moving to resemble modern hardware more closely; this is what comprises the "Lean and Mean" version. Legacy features and interfaces will become optional and be implimented in software, such as drivers, which may or may not make use of the programmable pipeline (quads/n-sided primitives could be triangulated using a shader program for instance, but its not required).


Khronos.org is the new home of OpenGL, read the last issue of their Pipeline newsletter for more information.

throw table_exception("(? ???)? ? ???");

Quote:Original post by jbizzler
2. I know the Direct3D world is getting rid of the fixed-function pipeline. Is the OpenGL community doing the same? I've noticed in all the tutorials I find, there's the PIXELFORMATDESCRIPTOR, with what looks like a lot of fixed-function settings. Is there a clean way to work around this, or should I just forget all those values? Is there any reason I should use it, and if I shouldn't, what are my guidelines for not doing so.

As people above said, OpenGL is moving away from the fixed function pipeline. However, PIXELFORMATDESCRIPTOR has nothing to do with OpenGL, nor with the fixed function pipeline. It's simply a Win32 structure used to define the pixel format of a rendering window.

Quote:Original post by jbizzler
3. I've noticed the WGL stuff only works in WindowProc. Why is this?

It isn't. WGL functions work fine outside of a WinProc.

Quote:Original post by jbizzler
What if I set up an HDC and HGLRC, make them current, but never use them because my app also supports Direct3D. Would this hurt anything?

That would be very bad. Either use OGL, or use D3D. Do not partially initialize one, and then continue with the other. This will seriously mess things up. OGL and D3D are mutually exclusive within the same application. They cannot be used simultaneously.
1.) BAD NEWS: Unfortunately, because of the old "spec only" mentality, the current way versioning works in the API is based on the platform's implementation. For Windows, Microsoft has kept it lagging behind at OGL v1.2 for ages. And the only way to access functions of newer versions is through a slightly messy process of identifying whether the extension is supported or not by searching through a large string of available extensions on your platform. Then, manually loading all the functions associated with it via the clunky "wglGetProcAddress()". Before doing that, you'd also have to have downloaded the "glext.h" header file from opengl.org and included it in your project.

GOOD NEWS: The GLEW and GLEE libraries make this pitifully easy to work around. GLEE just loads every available extension, while GLEW lets you pick and choose the extensions you want, and/or the version of OGL you want via macros. Fortunately, the newer, more involved mentality of OpenGL promises to make the process less troublesome in future versions.

2.) The new "lean and mean" version of OGL, code-named Longs Peak, will be removing all the fixed-function capabilities and layering them on top of the core functionality.

As a clarification, the PIXELFORMATDESCRIPTOR, and the wgl* functions are part of how you configure Windows to receive and display drawing commands from OGL. It's somewhat akin to setting up the caps in D3D. Similarly, you're also setting up HDC (device context) and HGLRC (rendering context), which may look a little different, but is the same idea.

For a better idea of all this, check out NeHe's tutorials @ http://nehe.gamedev.net/ .

[Hardware:] Falcon Northwest Tiki, Windows 7, Nvidia Geforce GTX 970

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework

I didn't know OpenGL was so active. These soon-to-be updates sound very exciting. How will they end up on my system, though? Will my graphics card just have a driver update, and I access it through extensions, or will they release their own SDK outside of the Windows SDK?

wglMakeCurrent fails if I do it anywhere outside of WindowProc's WM_CREATE. I don't know why.

If I start programming now, how different will any OpenGL future updates be? I want the cleanest, forward-looking implementation possible. Docs on OpenGL from 2000 don't look much different than they do now.

Okay, so PIXELFORMATDESCRIPTOR is a Windows thing? How does all its info affect OpenGL though? I haven't looked too deep, but why does it have stuff for depth and stencil buffers? Shoudl I just set these to zero and control them myself like I would with Direct3D 10, or do they have to match?

The extension/specs idealogy is going to take some getting used to. I just feel like when I'm reading a tutorial, like I don't know if it's the most modern, politically correct way of doing things.
Right now, all updates are in driver revisions. The way forward for the new version is currently unclear, however the hope is that Khronos will release a lib/header set for people to link to for each platform; updates and hardware functionality will come in drivers still; the lib is likely to be a stub which just lets you talk to the hardware.

The new version (Longs Peak or LP) is going to be VERY different from the OpenGL people are used to; gone (or "emulated") are all the 'nice' functions such as glVertex, instead everything is buffers of data; however this is a Good Thing(tm) as it represents how the hardware works better which means better speed [smile]
Some info on using GL 2.0 here, how to use it, etc.
http://www.opengl.org/wiki/index.php/Main_Page
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);
Okay, so I'm not the only one hoping for a header/static library package. I'd feel much cleaner that way.

Thanks everyone. I feel I have a better understandig of the world now.

This topic is closed to new replies.

Advertisement