PDA

View Full Version : Where are the headers to OpenGL 2.x ?



Richard E Collins
12-21-2009, 07:58 AM
Seems a simple question, but I've spent all morning trying to find them and the best I can do is either the MesaGL which I don't want to use as I'm concerned about the license or the headers from the development package from NVidia that match my drivers, which would make my app dependent on NVidia hardware, that is it would not work on the same disto as I have if the system had for example an ATI card.

I thought that with GL, like DirectX, I could write an app on my Ubuntu 9.10 system, send to a friend with the same Ubuntu 9.10 distro but a different hardware but still run it. Seems this is not the case?

Am i wrong?

ZbuffeR
12-21-2009, 11:55 AM
Fortunately you are wrong :)

For GL headers, both gl.h (generic) and glext.h (GL > 1.2 and extensions) :
http://www.opengl.org/registry/#headers

Read this for a general background :
http://www.opengl.org/wiki/Getting_started

In particular, the GL extension mechanism allow an application to query at runtime for particular extensions, and get new entry points of the API dynamically, without being linked to a particular binary lib version.

If that sound complex for you, 2 nice libraries with non-restrictive licenses allow to handle extensions easily :
http://glew.sourceforge.net/
http://elf-stone.com/glee.php

Dark Photon
12-21-2009, 12:01 PM
Seems a simple question, but I've spent all morning trying to find them and the best I can do is either the MesaGL which I don't want to use as I'm concerned about the license or the headers from the development package from NVidia that match my drivers, which would make my app dependent on NVidia hardware, that is it would not work on the same disto as I have if the system had for example an ATI card.

I thought that with GL, like DirectX, I could write an app on my Ubuntu 9.10 system, send to a friend with the same Ubuntu 9.10 distro but a different hardware but still run it. Seems this is not the case?

Am i wrong?


It's not clear what your core question is, or what problem you hit. Are you concerned about license compatibility or binary portability?

As far as license, including Mesa or NVidia GL headers isn't going to make a difference to you. Mesa core has MIT license which is pretty liberal, use with commercial or non-commercial software -- no problem. Similar to using NVidia headers. They don't have any rights to your code, no matter what you do, or whether it's commercial or not.

Also, using NVidia GL headers won't inherently make your app link-compatible only with NVidia GL. Now you "can" make your app link-depending on NVidia GL libraries by compiling/linking directly to extension functions in libGL.so, as opposed to using glXGetProcAddress to query for function pointers. Note that using a GL extension lib like GLEW will do the latter for you automatically.

And as a subset of the previous, of course making your app unconditionally depend on vendor specific extensions will mean your app requires that vendor's GL.

But avoid the above, and don't depend on vendor-specific implementation "quirks", and your app can be portable cross-vendor, even binary compatible across different systems.

Note though your friend running Ubuntu 9.10 distro still needs to have the appropriate dependent library packages installed that your app uses (either directly or indirectly) -- this kinda falls in the "well, duh!" category. Run ldd on your executable to see what these are. Things like GCC libs, etc.

Richard E Collins
12-22-2009, 02:34 AM
Fortunately you are wrong :)

For GL headers, both gl.h (generic) and glext.h (GL > 1.2 and extensions) :
http://www.opengl.org/registry/#headers


In particular, the GL extension mechanism allow an application to query at runtime for particular extensions, and get new entry points of the API dynamically, without being linked to a particular binary lib version.


Are you saying to use GL 2 for example I create GL, using the headers you pointed to and then grab the function pointers to the GL2.0 functions I wish to use? I thought GL 2.0 had a load of extra values defined too??? Hence the expectation of there being GL 2 headers.

Richard E Collins
12-22-2009, 02:49 AM
It's not clear what your core question is, or what problem you hit. Are you concerned about license compatibility or binary portability?

As far as license, including Mesa or NVidia GL headers isn't going to make a difference to you. Mesa core has MIT license which is pretty liberal, use with commercial or non-commercial software -- no problem. Similar to using NVidia headers. They don't have any rights to your code, no matter what you do, or whether it's commercial or not.

Also, using NVidia GL headers won't inherently make your app link-compatible only with NVidia GL. Now you "can" make your app link-depending on NVidia GL libraries by compiling/linking directly to extension functions in libGL.so, as opposed to using glXGetProcAddress to query for function pointers. Note that using a GL extension lib like GLEW will do the latter for you automatically.

And as a subset of the previous, of course making your app unconditionally depend on vendor specific extensions will mean your app requires that vendor's GL.

But avoid the above, and don't depend on vendor-specific implementation "quirks", and your app can be portable cross-vendor, even binary compatible across different systems.

Note though your friend running Ubuntu 9.10 distro still needs to have the appropriate dependent library packages installed that your app uses (either directly or indirectly) -- this kinda falls in the "well, duh!" category. Run ldd on your executable to see what these are. Things like GCC libs, etc.




Yer, after I wrote and posted the post I did too think that I was asking too many questions which kind of confused each other. Just a reflection of my confusion. :)

I've done a lot of work over the past few years with GLES 1.1 and GLES 2.0 In both cases the drivers supplied with the hardware from the HW vendor, so for example ImgTech, also came with GLES 1.1 and GLES 2.0 headers. Now for the mobile sphere these headers are tweaked and does tie an binary to a platform, but that is a given.

So moving onto the Linux desktop I expected to pop over to a global repository and fetch GL 2.0 headers and then link against either the libGL.so files on my system or some other common Linux lib that delt with patching GL functions to the driver, much like windows does with DirectX.

As regards the License the company I work for is very careful about using any Licensed code that requires that copy right to be included in the application, for example GLEW. So I have to be very careful as I can't ensure any 3rd party libs are not using patented code, even if by mistake. The company I work for get sued by patient trolls every day! Really they do it's bonkers. So I was hoping to use GL directly without the need to use any 3rd party libs.

Ta,
Richard e Collins. :)

ZbuffeR
12-22-2009, 03:58 AM
Are you saying to use GL 2 for example I create GL, using the headers you pointed to and then grab the function pointers to the GL2.0 functions I wish to use? I thought GL 2.0 had a load of extra values defined too???
Yes.
And extra values (ie. for GL 2) are defined in glext.h also.