PDA

View Full Version : OpenGL fixed/programmable confusion



Aliii
01-12-2013, 05:27 PM
Ive been using OpenGL 1 for a few years and now I want to move on to the programmable pipeline.
There are a few things I would like to know:
-How can I install a newer GL version?
-I dont understand how the GL versions, libraries, DLLs, functions work, ...how are they compiled. I guess they are not just compiled into machine code. ...like my PC supports openGL 4, but Im writing my apps in 1.5. ...but its said that above 3.0 the deprecated functions no longer work.
-Is there such thing that I write an app in a newer GL version and it wont run on an older machine?(or vica versa)
-How hard will it be to switch to the programmable pipeline? I used GLES2 last year, I liked it, but Im so used to the glBegin(GL_LINES) kind of functions....

Thanks a lot in advance!

aqnuep
01-12-2013, 05:58 PM
-How can I install a newer GL version?
You don't install OpenGL, you install your graphics driver which comes with the hardware vendor's implementation of OpenGL which can be any version that your hardware/driver supports. Any not so old card (after 2006) should support at least OpenGL 3.x, but more recent ones support OpenGL 4.x


-I dont understand how the GL versions, libraries, DLLs, functions work, ...how are they compiled. I guess they are not just compiled into machine code. ...like my PC supports openGL 4, but Im writing my apps in 1.5. ...but its said that above 3.0 the deprecated functions no longer work.
Deprecation doesn't mean anything in practice. You have everything in OpenGL 4.x, including the old immedate mode stuff (i.e. glBegin), but if you want to do things properly, forget about that **** and just use buffer objects and vertex arrays.


-Is there such thing that I write an app in a newer GL version and it wont run on an older machine?(or vica versa)
Sure there is. If someone has an older hardware it is very likely that it doesn't have hardware support for certain features in OpenGL 3.x or 4.x, but even a hardware that might be able to support something it has to have recent drivers installed, and even then there is no 100% guarantee as some GPUs aren't any more supported by the hardware vendors thus drivers are not updated with newer features either.


-How hard will it be to switch to the programmable pipeline? I used GLES2 last year, I liked it, but Im so used to the glBegin(GL_LINES) kind of functions....
If you did use GLES2 then you should know how hard it is, as GLES2 doesn't have glBegin and fixed function either. Practically, that's how hard it is, like switching from GL 1 to GLES2.

Aliii
01-13-2013, 11:00 AM
Thanks a lot! I would have a few more questions...

"Deprecation doesn't mean anything in practice. You have everything in OpenGL 4.x, including the old immedate mode stuff (i.e. glBegin), but if you want to do things properly, forget about that **** and just use buffer objects and vertex arrays."

So if I have a hardware that supports GL3.x and I have the drivers installed ...then It can execute all the GL commands from 1.0 to 3.x? Can I use all those commands in my code too? Shouldn I change the headers or lib files? If yes then how come that with the new ones I can still use glBegin, while its said that in 3.1 those were all removed?
Are any of the GL libraries statically linked or will the program look for the installed ones on the machine Im running it on?
(These are not clear to me at all)

aqnuep
01-13-2013, 03:21 PM
So if I have a hardware that supports GL3.x and I have the drivers installed ...then It can execute all the GL commands from 1.0 to 3.x? Can I use all those commands in my code too?
Yes, and yes.


Shouldn I change the headers or lib files?
You might need an up-to-date version of the glext.h header that is available in OpenGL extensions registry. You might also need an extension loader library like GLEW (or you can write your own ones), as every entry point that is beyond OpenGL 1.1 is usually acquired through xxxGetProcAddress (at least if you work on Windows).


If yes then how come that with the new ones I can still use glBegin, while its said that in 3.1 those were all removed?
Once again, nothing has been removed.
OpenGL 3.0 deprecated glBegin and fixed function stuff.
OpenGL 3.1 removed them, but actually reintroduced it through the ARB_compatibility extension (which all vendors support as far as I can say).
OpenGL 3.2 introduced two separate profiles: core (which does have glBegin and fixed funciton removed) and compatibility. But in compatibility profile you have everything and a compatibility profile is the default you get.

Vendors can decide that from OpenGL 3.2 if they only want to support core profile only (that's what Apple did and what should have been to proper way to do it), but most drivers do support the compatibility profile, thus you can use all that old non-sense glBegin stuff and fixed function even in OpenGL 4.3 (unfortunately).


Are any of the GL libraries statically linked or will the program look for the installed ones on the machine Im running it on?
I've never seen a single platform where OpenGL was statically linked. It is at least usually a dynamic library (DLL on Windows, SO on Linux). But why does that matter for you at all? Nothing changes regarding that from OpenGL 1.x to 4.x.

tonyo_au
01-13-2013, 04:16 PM
Vendors can decide that from OpenGL 3.2 if they only want to support core profile only (that's what Apple did and what should have been to proper way to do it), but most drivers do support the compatibility profile, thus you can use all that old non-sense glBegin stuff and fixed function even in OpenGL 4.3 (unfortunately).

Clearly you have not supported production code:sorrow:

aqnuep
01-13-2013, 09:04 PM
Clearly you have not supported production code:sorrow:
Believe me, I did (even if not OpenGL code), and actually that's one more reason for saying that, as once production code reaches its level when it is not maintainable properly anymore, there is need for a clean cut.

Also, I don't really understand why it would be necessary to have e.g. transform feedback or image load/store when using immediate mode. You'd probably better of doing the whole thing on the CPU instead, as with immediate mode you'll never really use your GPU effectively enough to even justify installing one.

What I'm saying is that GL 3.x+ features will only ever really benefit only people who use VBOs and shaders anyways.

Aliii
01-13-2013, 11:24 PM
Thanks a lot! Its clear now.
I think the immediate stuff is not a bad thing. Many people start to learn opengl cause its relatively easy, it gives you results fast. At least they dont end up with DirectX:)

Alfonse Reinheart
01-14-2013, 12:13 AM
Is the Dark Side stronger?

No! No. Quicker. Easier, more seductive.

You can learn fast, or you can learn right. Which is more important, I'll leave to you to decide.

tonyo_au
01-14-2013, 04:45 AM
What I'm saying is that GL 3.x+ features will only ever really benefit only people who use VBOs and shaders anyways.
Fortunately I have convinced my current benefactors of this and I have spent the last couple of years completely redeveloping a system that is currently all immediate mode and other ods and ends and more that 15 years old.:whistle:. My previous benefactors were not so wise:disgust:

aqnuep
01-14-2013, 07:22 AM
Fortunately I have convinced my current benefactors of this and I have spent the last couple of years completely redeveloping a system that is currently all immediate mode and other ods and ends and more that 15 years old.:whistle:. My previous benefactors were not so wise:disgust:
So at the end, you do agree with me :)