LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-18-2004, 07:48 PM   #1
swinchen
Member
 
Registered: Apr 2004
Location: Maine (USA)
Distribution: Slackware 9.1
Posts: 45

Rep: Reputation: 15
OpenGL Architecture - How it all Works?


Hello,

I have a quick question about OpenGL and the supporting libraries.

First of all who makes the actual OpenGL library - and how does it compare/work with the video driver?

What is GLU and who makes that/How did it get on my system?

Same questions for glaux, although I believe glaux is no longer suggested.

I am using both linux (Slackware 9.1) and Windows XP and the questions apply to both. I guess the question boils down to understanding how everything "talks" together.

Thanks for your time,

Sam
 
Old 04-18-2004, 11:57 PM   #2
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
> First of all who makes the actual OpenGL library

The good folks at mesa3d.org make one. Since OpenGL is a specification for a 3d API (and interface to 3d video hardware), the OpenGL libs are one particular implementation of that spec.

> and how does it compare/work with the video driver?

I don't know the details about that. I know that DRI uses mesa, and I know that when your hardware doesn't do some particular OpenGL function, mesa can take over and just do it in software.

> What is GLU and who makes that/How did it get on my system?

It's a library of calls that wrap plain OpenGL calls, and which do some higher level things for you. It's a convenience to use GLU oftentimes. GLU is a standard part of OpenGL. Always use GLU calls in your code to make your life easier.

Your GNU/Linux distro maker put them on your system, of course. :)

> Same questions for glaux, although I believe glaux is no longer suggested.

Don't use glaux. Forget about glaux. It was a higher-lever (even higher than GLU) lib that was replaced by glut. Though, glut's not entirely Free. There's an OpenGLUT project I think, but I don't know about it's status.

I've got no idea how OpenGL works on MS Windows, except that, yes, it does work, but no, it's not the most updated version. MS wants you to use their closed Direct3D/DirectX system, but are forced to still provide OpenGL since many of their users demand it.

Last edited by johnMG; 04-19-2004 at 12:00 AM.
 
Old 04-19-2004, 08:42 AM   #3
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
For Windows, the OpenGL implementation is handled by the video card maker, if they so desire. There is a software implementation of OpenGL 1.1 written by Microsoft, but it's slooooow. Video card drivers don't replace the OpenGL DLLs. Instead, the Microsoft DLL allows for an Installable Client Driver (ICD) architecture. Basically, this allows opengl32.dll to pass OpenGL on calls to the video driver, if the video driver supports OpenGL.

Mesa3d isn't technically OpenGL. Here's a quote from the mesa3d.org web page:
Quote:
Mesa is a 3-D graphics library with an API which is very similar to that of OpenGL.* To the extent that Mesa utilizes the OpenGL command syntax or state machine, it is being used with authorization from Silicon Graphics, Inc.(SGI). However, the author does not possess an OpenGL license from SGI, and makes no claim that Mesa is in any way a compatible replacement for OpenGL or associated with SGI. Those who want a licensed implementation of OpenGL should contact a licensed vendor.

Please do not refer to the library as MesaGL (for legal reasons). It's just Mesa or The Mesa 3-D graphics library.


* OpenGL is a trademark of Silicon Graphics Incorporated.
glaux is a static Microsoft library (i.e. no DLL), and should be avoided like the plague. About the only thing of any use in it now is the ability to load BMP images, which glut doesn't handle. But even for that you are better off finding a 3rd party library, or writing your own image handling code, since glaux isn't very portable. It isn't even well supported by all Windows compilers. TGA files are easy to write your own loader for, and they support an alpha channel!

Last edited by deiussum; 04-19-2004 at 08:46 AM.
 
Old 04-19-2004, 08:57 AM   #4
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
> Mesa is a 3-D graphics library with an API which is very similar to that of OpenGL.

So similar, in fact, that it's pretty much indistinguishable. Kudos to the Mesa developers.

deiussum, thanks for the good explanation of ICD.
 
Old 04-19-2004, 09:22 AM   #5
swinchen
Member
 
Registered: Apr 2004
Location: Maine (USA)
Distribution: Slackware 9.1
Posts: 45

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by johnMG
> Mesa is a 3-D graphics library with an API which is very similar to that of OpenGL.

So similar, in fact, that it's pretty much indistinguishable. Kudos to the Mesa developers.

deiussum, thanks for the good explanation of ICD.
Ok, the Windows version makes sense to me now. The driver contains the actual OpenGL implementation which makes sense. The Windows opengl32.dll is what hands the commands to the driver.

Now I have fooled around with Mesa/DRI/GLX/NVidia Drivers and have found that world VERY confusing. I guess this is where the question begins:

When I start an OpenGL application under linux... if I am using the MESA Library how does my application get hardware accelerated. when I call some glFunction which library actually talks to the video card?

I think DRI is basically drivers.
MESA is a software clone of OpenGL's sepcifications
GLX is something entirely different?

I know NVIDIA drivers some with their own libGL.so, so that is the OpenGL library. Is DirectRendering to the screen as fast in linux as it is in Windows?
 
Old 04-19-2004, 08:14 PM   #6
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
> MESA is a software clone of OpenGL's sepcifications

It's an OpenGL implementation. OpenGL says, "this is the way your function calls should look". Mesa say, "cool, here's a bunch of function calls that fit the bill."

> GLX is something entirely different?

GLX is the pile of OpenGL-related X Window System function calls that do things outside the scope of the OpenGL spec (like opening a window (and the so-called "rendering context" that goes with it), setting its bit depth, etc.).

There's a lot of good info on the DRI website that explains all of this. After reading that, the DRI mailing list should be a good place to ask questions.

There's also folks on the forums at www.opengl.org that might be able to explain more.

> Now I have fooled around with Mesa/DRI/GLX/NVidia Drivers and have found that world VERY confusing.

I agree and think it's very confusing.
 
Old 05-13-2004, 09:32 AM   #7
nsfluent
LQ Newbie
 
Registered: May 2004
Location: New Hampshire
Distribution: Mandrake 10
Posts: 2

Rep: Reputation: 0
FreeGLUT and OpenGLUT

OpenGLUT and FreeGLUT are both opensource alternatives
to Mark Kilgard's GLUT.

FreeGLUT is binary-compatible with GLUT.

OpenGLUT is a branch of FreeGLUT that is more experimental,
evolving the API and adding new features.

Cheers,

Nigel Stewart
 
Old 05-14-2004, 07:23 AM   #8
cjp
Member
 
Registered: Dec 2003
Location: the Netherlands
Distribution: SuSE 9.0
Posts: 54

Rep: Reputation: 15
Take for example an openGL game written for windows and for Linux (I'm writing one on http://ultimatestunts.sf.net). The application uses openGL for 3D and SDL for window management and input.

The story in Linux:
The application is linked to libGL.so, libSDL.so and some X window libs. libGL.so accepts openGL commands and makes sure that they are put on the screen in some way. There are several possibilities for this. If you don't have 3D acceleration, then libGL could contain a software renderer which gives a 2D image as output to the X window system. This is the case with Mesa. libGL could also pass the openGL info to the X window system, if the GLX extension is present. Then, the X window system could do software rendering (using Mesa) or use hardware acceleration.

In the DRI case, libGL can get permission to access the video card directly. In most (all?) cases it needs a kernel module for this, and the DRI (and GLX?) extension in the X window system. I don't know the details about this, but I'm sure you can find them on the DRI website.

Most video cards only have acceleration for a few parts of openGL (like texture mapping, z buffering and shading). Other parts are implemented in software. Creators of openGL drivers usually take an existing software implementation , and replace some parts of it by parts that use the hardware acceleration.

Back to the application. It uses openGL for 3D, but it also needs to do window management. There are several libraries that do window management for openGL (like glut and SDL), and they all use the X window libraries, and the glx library, which is a sort of "glue" to let openGL and the X window system work together. BTW the glx library is something else than the GLX extension. All openGL applications that are made for X window systems use the glx library (directly or indirectly), but the GLX extension can only be used if it is available on the X server.

The story in Windows:
The application is linked to opengl32.dll, SDL.dll and some windows libs. opengl32.dll accepts openGL commands and makes sure that they are put on the screen in some way. Some details on how this is done are mentioned by deiussum (I didn't know that ICD stuff). The windows counterpart of the glx "glue" is the wgl library. The windows version of SDL uses wgl, the Linux version of SDL uses glx. As a programmer, you only need to deal with openGL and your window management library (SDL), which doesn't require knowledge of the internals.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenGL works 3D accelleration doesn't lowpingnoob Linux - Newbie 20 06-14-2005 01:22 PM
Overwrite Mesa OpenGL with ATI OpenGL Carl-Fredrik Slackware 12 10-01-2004 03:33 PM
Changing from MESA OpenGL to ATI OpenGL tillyoubreakit Linux - Hardware 19 10-07-2003 07:32 PM
OpenGL is needed by plib-1.7.0- but i have opengl ! qwijibow Linux - Newbie 0 08-05-2003 07:12 AM
OpenGL problem, works for root, not users Dusan Linux - Hardware 4 06-22-2003 06:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration