PDA

View Full Version : OpenGL vs MESA



mikeglaz
11-04-2012, 08:35 AM
I was wondering why in the Linux world we must use MESA instead of OpenGL? Is MESA identical to OpenGL? Also, why is MESA behind in version numbers compared to OpenGL?

thanks,
mike

Dark Photon
11-04-2012, 11:40 AM
Mesa3D provides an OpenGL implementation, just like NVidia's, AMD's, or Intel's drivers provide an OpenGL implementation. They are all OpenGL implementations. Like Ford, Buick, and Toyota are all types of cars.

You don't have to use Mesa3D's OpenGL implementation. You can install another by installing your GPU vendor's driver, if they offer one. I personally use NVidia's on Linux. Works great!

A separate issue is that Mesa3D also provides (in addition to an OpenGL implementation) their own version of the GLU OpenGL utilities library. You can use that irrespective of which underlying OpenGL implementation you choose to run. It's not tied to one or another (AFAIK).

mikeglaz
11-04-2012, 12:19 PM
Mesa3D provides an OpenGL implementation, just like NVidia's, AMD's, or Intel's drivers provide an OpenGL implementation. They are all OpenGL implementations. Like Ford, Buick, and Toyota are all types of cars.

You don't have to use Mesa3D's OpenGL implementation. You can install another by installing your GPU vendor's driver, if they offer one. I personally use NVidia's on Linux. Works great!

A separate issue is that Mesa3D also provides (in addition to an OpenGL implementation) their own version of the GLU OpenGL utilities library. You can use that irrespective of which underlying OpenGL implementation you choose to run. It's not tied to one or another (AFAIK).

Ok, where do I get the nVidia implementation. I looked all over their site and all I see are .exe's.

Dark Photon
11-04-2012, 12:58 PM
Google nvidia driver download and the link comes right up.

Usually though you can just install it through your distro's package manager. Often that's simpler. Google your distros name + nvidia driver install for details.

dirk103
11-04-2012, 03:15 PM
Ok, where do I get the nVidia implementation. I looked all over their site and all I see are .exe's.

(This isn't 100% accurate but it gets the point across)

You wouldn't be trying to develop for a newer version of OpenGL are you?
Trying to access new features, or maybe just worried about performance?

It's the new version _development libraries_ you want isn't it?

Well my friend it's GLEW you want!
http://glew.sourceforge.net/

This is a library that gives you entry points into the newer features of OpenGL such as the functions:

glEnableClientState, glVertexPointer


OpenGL itself is a specification to render fancy graphics to a video card.

There are different implementations to it such as MESA, nVidia's OpenGL, ATI OpenGL, Microsoft OpenGL. Some of these such as MESA, are _software_ implementations. They do 3D rendering completely on your computer and do not take advantage of your fancy video card at all. Others like the nVidia, will take full advantage of the video card, the nVidia drivers will access the specific video card model and hand off the processing to it.

Okay, easy enough right. Now why do you keep seeing MESA pop up, and why is your program so sloooow?

on your computer you'll see windows/opengl32.dll, i believe this is the Microsoft _software_ implementation. Slow and it's probably the OpenGL 1.1 specification. It wont have any new functionality at all. Somewhere else you'll have a opengl.dll that comes from nVidia, this is the one you want.. but
when you link opengl32.lib (microsoft visual c++) to your program, you are linking a static library, that accesses the dynamic library(opengl32.dll) that is the microsoft implementation. You don't want to do this. You want to link against a static library that will access the more modern opengl32.dll. GLEW is a multiplatform library written by opensource people, that will allow you to access new OpenGL features on any platform.

You want to download and copy the .DLL filse to /windows/system32
the library and include files to their respective folder in your compiler.

Are you using Visual C++?

mikeglaz
11-04-2012, 06:46 PM
(This isn't 100% accurate but it gets the point across)

You wouldn't be trying to develop for a newer version of OpenGL are you?
Trying to access new features, or maybe just worried about performance?

It's the new version _development libraries_ you want isn't it?

Well my friend it's GLEW you want!
http://glew.sourceforge.net/

This is a library that gives you entry points into the newer features of OpenGL such as the functions:

glEnableClientState, glVertexPointer


OpenGL itself is a specification to render fancy graphics to a video card.

There are different implementations to it such as MESA, nVidia's OpenGL, ATI OpenGL, Microsoft OpenGL. Some of these such as MESA, are _software_ implementations. They do 3D rendering completely on your computer and do not take advantage of your fancy video card at all. Others like the nVidia, will take full advantage of the video card, the nVidia drivers will access the specific video card model and hand off the processing to it.

Okay, easy enough right. Now why do you keep seeing MESA pop up, and why is your program so sloooow?

on your computer you'll see windows/opengl32.dll, i believe this is the Microsoft _software_ implementation. Slow and it's probably the OpenGL 1.1 specification. It wont have any new functionality at all. Somewhere else you'll have a opengl.dll that comes from nVidia, this is the one you want.. but
when you link opengl32.lib (microsoft visual c++) to your program, you are linking a static library, that accesses the dynamic library(opengl32.dll) that is the microsoft implementation. You don't want to do this. You want to link against a static library that will access the more modern opengl32.dll. GLEW is a multiplatform library written by opensource people, that will allow you to access new OpenGL features on any platform.

You want to download and copy the .DLL filse to /windows/system32
the library and include files to their respective folder in your compiler.

Are you using Visual C++?

I'm using gcc on Linux Mint 13. I do have an nVidia card. So will GLEW be hardware accelerated by my nVidia card?

mikeglaz
11-04-2012, 08:33 PM
ok, I compiled and installed GLEW using make and make install. But now how do I use it? Inside my Makefile I used the following for MESA:



objects = main.o

cube: $(objects)
g++ -o cube $(objects) -lX11 -lXi -lglut -lGL -lGLU -lm

main.o: main.cpp
g++ -c main.cpp


Do I need to do something different? The GLEW page doesn't mention much.

dirk103
11-04-2012, 09:51 PM
ok, I compiled and installed GLEW using make and make install. But now how do I use it? Inside my Makefile I used the following for MESA:

I'm not a %100 sure but try something like this:
Try without the -lGL
instead replace it with glew or maybe GLEW




objects = main.o

cube: $(objects)
g++ -o cube $(objects) -lX11 -lXi -lglut -lglew -lGLU -lm

main.o: main.cpp
g++ -c main.cpp


Do I need to do something different? The GLEW page doesn't mention much.

Dark Photon
11-05-2012, 04:43 AM
ok, I compiled and installed GLEW using make and make install.
The GLEW post muddied the waters a bit. GLEW is just wrapper library over the OpenGL implementation. You can use it or not. It's not required. And it has nothing to do with your Mesa vs. vendor driver OpenGL question.

Suggest you get the NVidia driver installed first. glxinfo will confirm you have done so.

mikeglaz
11-05-2012, 11:32 AM
I'm not looking for a driver. I'm looking for an API to develop in. I noticed that OpenGL is on version 4.3 while Mesa is on 3.1. I know that on Windows I'm able to use version 4.3 with the libraries that come with Windows. So I was wondering if I could get version 4.3 on Linux? Does this make sense or am I asking the wrong question?

mike

Alfonse Reinheart
11-05-2012, 01:56 PM
You are looking for a driver, because the driver is what implements the API. If you don't have 4.3-capable drivers installed on Windows, you don't get 4.3 support. Same goes for Linux.

padawan
11-06-2012, 07:54 AM
http://www.itworld.com/software/289579/install-nvidia-driver-30432-linux-mint-13-or-ubuntu-12041210

Can't be that difficult

dirk103
11-07-2012, 04:23 PM
Okay guys he has his video card drivers installed obviously, who doesn't, especially if they're programming. He's worried he's not developing using his video cards full potential.

The only drawback to using OpenGL 3.1 instead of 4.3 is you don't have access to a few specialized hardcore features. 3.1 will be just as fast.