Starting with OpenGL

Started by
18 comments, last by James Trotter 18 years, 9 months ago
Quote:Original post by James Trotter
It would depend on your distribution. Usually the OpenGL and GLU headers are installed in /usr/include/GL. If you're running X, then it's likely that they're installed. In Debian, for instance, the headers are included in the xlibmesa-gl-dev and xlibmesa-glu-dev packages.
Otherwise, the ATI drivers should install the necessary libraries and headers.


About the header files: I don't think they are part of the driver. As with windows, the drivers only overwrite your gl libraries. This can be especially annoying on linux distributions which come with bad headers (such as my old Red Hat 7.2 distribution). You can solve that by overwriting the gl headers with the MESA headers, or by using GLEW. I would recommend GLEW, as it is a perfect tool for creating platform-independant OpenGL programs (especially if you use the latest extensions).

Tom
Advertisement
As far as I know, GLEW doesn't actually let you write platform-independent OpenGL programs in itself. It allows for cross-platform means of using OpenGL extensions. You might have meant GLFW, which is a framework for writing cross-platform OpenGL applications. (However, if you're new to OpenGL I'd recommend you use GLUT instead. This is what they use for the code examples in the red book.)
Quote:Original post by James Trotter
As far as I know, GLEW doesn't actually let you write platform-independent OpenGL programs in itself. It allows for cross-platform means of using OpenGL extensions. You might have meant GLFW, which is a framework for writing cross-platform OpenGL applications. (However, if you're new to OpenGL I'd recommend you use GLUT instead. This is what they use for the code examples in the red book.)


That is correct. My wording was rather ackward. What I meant to say, was that it allows platform independant access to the GL library and extensions. Of course, for os-dependant things like creating windows, you could use glut.

Tom
Quote:Original post by James Trotter
Quote:Original post by NamelessTwo
I'm especially interested in Linux.

Where can I find OGL headers and OGL precompiled libraries, samples, tutorials, etc. Also I have ATI card.


It would depend on your distribution. Usually the OpenGL and GLU headers are installed in /usr/include/GL. If you're running X, then it's likely that they're installed. In Debian, for instance, the headers are included in the xlibmesa-gl-dev and xlibmesa-glu-dev packages.
Otherwise, the ATI drivers should install the necessary libraries and headers.


I use Ubuntu and it comes with Mesa 5 which does not support OGL 1.5 but I intend to compile Mesa 6. Is it possible to install Mesa locally just for the program I develop or I have to replace the original Mesa? I want to do this so that the end user does not need to update his Mesa.

What is GLEW? Does it replace gl.h and glu.h and the appropriate libraries?

Where can I find OpenGL 1.5 headers for Windows?
Quote:Original post by James Trotter
As far as I know, GLEW doesn't actually let you write platform-independent OpenGL programs in itself. It allows for cross-platform means of using OpenGL extensions. You might have meant GLFW, which is a framework for writing cross-platform OpenGL applications. (However, if you're new to OpenGL I'd recommend you use GLUT instead. This is what they use for the code examples in the red book.)


For better crossplatform compatability I'll use SDL - OpenGL, SDL, GLSL and standard C++ libraries only.

I have lots of books and tutorials about OpenGL but none explain how to use the latest versions and GLSL on ATI hardware. That's why I'm asking here.
Another nameless person in the virtual space...
Quote:Original post by Anonymous Poster
I use Ubuntu and it comes with Mesa 5 which does not support OGL 1.5 but I intend to compile Mesa 6. Is it possible to install Mesa locally just for the program I develop or I have to replace the original Mesa? I want to do this so that the end user does not need to update his Mesa.


I use Ubuntu too. [smile]
If the mesa library uses shared linking, then it has to be available on the system running your programs. If it is statically linked, however, then all the symbols should be included in the executable you compile on your system.

Quote:
What is GLEW? Does it replace gl.h and glu.h and the appropriate libraries?


Not exactly. It does not replace gl.h and glu.h, but it does provide definitions and entry points for functions defined in the OpenGL specification not otherwise available. In other words, it allows you to use OpenGL 2.0. But, of course, only if your graphics card supports the necessary extensions.

Quote:
Where can I find OpenGL 1.5 headers for Windows?


GLEW is cross-platform, and works just as well in Windows as in Linux. (I've tried them both myself!)

Quote:Original post by NamelessTwo
For better crossplatform compatability I'll use SDL - OpenGL, SDL, GLSL and standard C++ libraries only.


SDL also allows you to create cross-platform OpenGL applications. Though, personally I prefer GLFW or glut. SDL is really more than just a windowing framework, and provides alot of unnecessary functionality for my needs. Although it certainly is cool that it provides you with functionality for audio, CD-rom, timers, threads, and probably more.

Quote:
I have lots of books and tutorials about OpenGL but none explain how to use the latest versions and GLSL on ATI hardware. That's why I'm asking here.


I'm pretty sure you need to access glsl functionality through extensions, (ARB_shading_language_100, ARB_shader_objects).
That at least goes for OpenGL's interface to glsl programs. You can write glsl code independently, as it's a language of its own.

[Edited by - James Trotter on July 6, 2005 2:01:22 PM]
Thank you for your extensive reply!

Quote:
Not exactly. It does not replace gl.h and glu.h, but it does provide definitions and entry points for functions defined in the OpenGL specification not otherwise available. In other words, it allows you to use OpenGL 2.0. But, of course, only if your graphics card supports the necessary extensions.


So I've found this tutorial:
http://www.lighthouse3d.com/opengl/glsl/index.php?ogloverview
It describes how to setup OpenGL with GLEW and glut.

I think that current ATI drivers support OpenGL 1.5 only. Probably both on Windows and Linux.
Would I be able to use OpenGL 1.5 functionality with GLEW? I've also checked GLEE but I don't see the difference.

In case I have OpenGL 2.0 compatible driver and MESA 5.0 (which supports only... I don't know what version but it isn't greater than 1.4 for sure), could I use OpenGL 2.0 functionality with GLEW?

Are there any other GLEW tutorials for beginners?

Quote:
Quote:
I have lots of books and tutorials about OpenGL but none explain how to use the latest versions and GLSL on ATI hardware. That's why I'm asking here.


I'm pretty sure you need to access glsl functionality through extensions, (ARB_shading_language_100, ARB_shader_objects).
That at least goes for OpenGL's interface to glsl programs. You can write glsl code independently, as it's a language of its own.



Yes that is true.
Another nameless person in the virtual space...
Quote:Original post by NamelessTwo
Thank you for your extensive reply!

I think that current ATI drivers support OpenGL 1.5 only. Probably both on Windows and Linux.
Would I be able to use OpenGL 1.5 functionality with GLEW? I've also checked GLEE but I don't see the difference.


I have never used GLEE, so I'm not certain. Though, I do think it generates definitions and entry points for OpenGL extensions automatically from the their specifications, like GLEW does. Someone here should be able to verify/correct this.

Quote:
In case I have OpenGL 2.0 compatible driver and MESA 5.0 (which supports only... I don't know what version but it isn't greater than 1.4 for sure), could I use OpenGL 2.0 functionality with GLEW?


I hope you realize that mesa does not benefit from hardware acceleration. If your drivers support it you should be able to use OpenGL 2.0 functionality. To check this, do something like:

if (GLEW_VERSION_2_0) {  // Use OpenGL 2.0 code...} else if (GLEW_ARB_shading_language_100) {  // We can't use OpenGL 2.0, so use the ARB_shading_language_100 extension instead...}


Quote:
Are there any other GLEW tutorials for beginners?


GLEW is extremely simple to use. All you should need to know is explained under GLEW basic usage.
Quote:
I hope you realize that mesa does not benefit from hardware acceleration. If your drivers support it you should be able to use OpenGL 2.0 functionality. To check this, do something like:


I mean the OpenGL headers in Ubuntu are those from the MESA library.

Quote:

GLEW is extremely simple to use. All you should need to know is explained under GLEW basic usage.


Sometimes I'm blind and stupid. I've been reading this page and I haven't seen this link! Horrible!

Thank you you've helped me a lot. I'm going to try it soon. I'll do a little bit more research & reading before I start. I think you've cleared alot of things for me.
Another nameless person in the virtual space...
Quote:Original post by NamelessTwo
Quote:
I hope you realize that mesa does not benefit from hardware acceleration. If your drivers support it you should be able to use OpenGL 2.0 functionality. To check this, do something like:


I mean the OpenGL headers in Ubuntu are those from the MESA library.



Ah, yes. I'm sorry, I misunderstood. You can actually use GLEW to access the functionality of OpenGL 2.0 (or any other version for that matter), regardless of the OpenGL headers installed on the system. I'm pretty certain that when you include glew.h. it takes care of defining all the things which are usually in gl.h. You don't actually include gl.h at all.

Quote:
Thank you you've helped me a lot. I'm going to try it soon. I'll do a little bit more research & reading before I start. I think you've cleared alot of things for me.


I'm glad I could help. [smile]

This topic is closed to new replies.

Advertisement