2

According to what i read here: http://www.linuxquestions.org/questions/linux-software-2/opengl-vs-mesa-whats-the-diff-351037/

Mesa is software rendering, while driver OpenGL is hardware rendering.

Every tutorial i came accross only show how to install Mesa. How can i set up a true (hardware accelerated) openGL? Does installing driver install the header? If so, which header? If i have a program compilled with mesa, do i have to recompile it to take the advantage of hardware accelerated? If installing the driver install the required library and header, what happen to mesa?

From the last post on the pointed site: "Does that mean that I should remove mesa packages if I have NVidia drivers installed?"

Also, now openGL is now version 4 and 5, but i can't find any tutorial that show how to create a context for those version, only version 3 max...

Like you can see, im not very sure how this work.

One last thing, this book: http://glprogramming.com/red/ is for which version of openGL? The guide version is 1.1 but it don't say it was written for which version.

user1115057
  • 1,815
  • 2
  • 18
  • 20
  • There are a *lot* of questions in this. You really should narrow it down to one topic. – Nicol Bolas Feb 16 '12 at 03:08
  • I can't help you with all of those questions but these links might help you get started. http://developer.nvidia.com/nvidia-graphics-sdk-11 http://developer.amd.com/sdks/Pages/default.aspx And of course, https://www.opengl.org/sdk/ – spaaarky21 Feb 16 '12 at 03:32
  • 1
    Btw there is no such thing as OpenGL version 5. Current GL version is 4.2 – Mārtiņš Možeiko Feb 16 '12 at 04:11

1 Answers1

7

Mesa is software rendering, while driver OpenGL is hardware rendering.

No. Mesa is an open source implementation of the OpenGL API and also provides a software rasterizer fallback. But Mesa is also the foundation for the open source GPU drivers for intel, radeon, radeonhd and noveau.

Every tutorial i came accross only show how to install Mesa. How can i set up a true (hardware accelerated) openGL?

OpenGL is just an API. That means it doesn't matter which implementation of OpenGL you use for development. You can develop with Mesa, but your program will run fine with propriatary drivers as well.

Does installing driver install the header?

Sometimes. But most Linux distributions prevent this and assume the Mesa headers as the canonical development resource.

If i have a program compilled with mesa, do i have to recompile it to take the advantage of hardware accelerated?

No. If you did everything right, i.e. linked your executable dynamically against libGL.so your program will work with any OpenGL implementation.

If installing the driver install the required library and header, what happen to mesa?

Depends on the distribution. Some distributions have the vendor driver replace libGL.so, but not the Mesa development files. Some distributions replace libGL.so and the headers. And some distributions put OpenGL implementations in /usr/lib/opengl and provide a tool for setting up symlinks (Gentoo). In practice, it doesn't matter.

From the last post on the pointed site: "Does that mean that I should remove mesa packages if I have NVidia drivers installed?"

Your distributions package manager will emit a warning if that's required. But like I said: It should no bother you, except, that the Mesa implementation supports only OpenGL-2.1. But that doesn't mean you cannot compile OpenGL-3 and upwards programs with it. They will just be not able to create an OpenGL-3 context and abort with an error message or fall back to OpenGL-2

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • Mesa implementation supports only OpenGL-2.1. But that doesn't mean you cannot compile OpenGL-3 and upwards programs with it. They will just be not able to create an OpenGL-3 context and abort with an error message or fall back to OpenGL-2..... Can you explain? im not sure i understand, how can i use opengl-3 without a opengl 3 context? – user1115057 Feb 16 '12 at 22:02
  • @user1115057: OpenGL-3 is accessed through the so called "extension" mechanism. Extensions allow a program to dynamically load additional features from the OpenGL implementation, if those are supported. The extension API has been fixed since OpenGL-1.1 and didn't change since then. So you can compile a program using Mesa, making use of the extensions. If Mesa is the OpenGL runtime implementation it will simply report the OpenGL-3 functions not being available, and your program muss fall back to OpenGL-2. If a OpenGL-3 capable implementation is present at runtime, you can access it then. – datenwolf Feb 17 '12 at 00:54
  • If Mesa is the OpenGL runtime implementation it will simply report the OpenGL-3 functions not being available, and your program muss fall back to OpenGL-2... You mean Mesa = no opengl-3, or you mean mesa + no extension = no opengl-3? Where can i get those extension? – user1115057 Feb 17 '12 at 02:20
  • @user1115057: Just forget about Mesa for the time being. The extensions are not some kind of extra software. The extension mechanism allows OpenGL implementations (=drivers) to extend the API without introducing the need to recompile programs or install new libraries. Mesa is just *some* OpenGL driver, and Mesa only supports OpenGL-2 so far. But the library you link against (libGL.so) looks to your program the same, no matter if you're using Mesa or some other driver. The extensions you get automatically when installaing your GPUs newest drivers, but only if the GPU actually supports them. – datenwolf Feb 17 '12 at 09:29
  • 1
    @user1115057: Note that, as along as you're only compiling and linking your programs (=build time) you just need some libGL.so and headers, so that the compiler and linker know, which *symbols* in it to reference in the executable – technically it could be just some bogus library just exporting a symbol table, but not containing a single code instruction. But at runtime the installed driver and the library matters. You asked about *compiling and building* and then it doesn't matter to you, because everything beyond OpenGL-1.1 is not exposed through symbols of libGL.so but through extension. – datenwolf Feb 17 '12 at 09:33
  • @user1115057: Extensions are described here http://www.opengl.org/archives/resources/features/OGLextensions/ --- and because loading them is boring, tedious and can be automated it's been encapsulated in a library called GLEW http://glew.sf.net - of course you must update GLEW to gain new extensions, because GLEW's symbol table is ever expanding. Just link GLEW statically to your program. – datenwolf Feb 17 '12 at 09:35