Jump to content
  • Advertisement
Sign in to follow this  
Eistoeter

OpenGL OpenGL Implementation?

This topic is 3738 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I'm currently learning OpenGL and I'm doing it very detailed. I got a question where I couldn't find an answer somewhere. I hope my english is not too bad. As far I understood things right OpenGL is implemented by the graphic card driver and also Direct3D. But why is it then, that I need to link with libopengl32 and libglu32? For that would mean linking the implementation into my program ... but this should be done by graphic card driver isn't it? So if OpenGL is implemented by the graphic card driver it would not be neccesary to link those libraries. That's what I do not understand. I've read that this is the Mesa3D implementation of OpenGL and that Mesa3D uses the Direct Rendering Interface to send OpenGL commands to the graphic card. But what sense does that make? What is the advantage of this method? I also don't know why in MinGW the gl.h file implements the OpenGL 1.2 Standard. I'm using SDL to create OpenGL context, so I only include SDL_opengl.h ... I've taken a look into that file and this also says that it implements OpenGL version 1.2 ... but version 2 is long available, so why isn't it used? Thanks for any answers.

Share this post


Link to post
Share on other sites
Advertisement
On Windows, for example, the actual OpenGL code is within the driver you install for each graphics card. The library you link against, however, is the layer between your application and the driver.

If you check your Windows install direction, you will find a file opengl32.dll, which is the interface to OpenGL on Windows. This is a complete implementation (although a bit old, but still) and can be used to render your images. This interface also provides a mechanism where third party software vendors (for exaple graphics card manufacturers with their drivers) can install additional renderers that will be used instead.

Therefore you only need to link against a single common library, and drivers hook into this generic interface, automatically giving you a different implementation.

Now, if this common interface is stuck with an old version, it cannot automatically handle higher versions. That's why the extension mechanism with wglGetProcAddress (again, on Windows as an example) exists, so you can manually request what functions the common library don't provide.

Share this post


Link to post
Share on other sites
OpenGL does not use Direct3D. OpenGL and Direct3D are graphics libraries. The purpose of a library is to provide a way of communicating with the graphics driver, which then in turn communicates with the actual hardware.

A driver is just a way of communicating with hardware, but the purpose of a graphics library is a bit different. A graphics library never actually communicates with hardware, but provides the user with easy ways of asking the driver to do complex things.

As far as includes go, gl.h and glu.h are the standard OpenGL includes. Anything beyond that serves to provide extra functionality. Since SDL is not technically part of OpenGL, it requires different include files. Since the purpose of a graphics library is to provide you with extra functionality, the include files you need depend almost completely on what functions you decide to use.

Share this post


Link to post
Share on other sites
Thanks a lot. I think it's a lot clearer to me now.

I already knew what a library and a driver is. I also know that OpenGL is not implemented trough Direct3D (what I wanted to say is that Direct3D is also implemented trough the graphic card driver LIKE OpenGL). That was a little bit of a misunderstanding right there.

So the library is the communication layer between application and graphic card driver. And it is not important what OpenGL version the library I link against is, because it will be redirected to the graphic card driver OpenGL version which will (in most cases) be the newest OpenGL implementation.

Have I understood this right?

Share this post


Link to post
Share on other sites
At the moment, OpenGL is backwards compatible (unlike D3D), so you should be able to use whatever version you choose without any problems.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!