Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL + Mesa 3D + MinGW

Tags:

mingw

opengl

I program C++ applications on (Ubuntu) Linux and compile them to 2 operating systems: natively to Linux by using "g++" (GNU C++ compiler) and cross-compile them to Windows by using "i386-mingw32-g++" (MinGW C++ cross-compiler).

Now, I am trying to cross-compile "OpenGL" applications (from Linux to Windows) - for that I need some OpenGL library files.
As an implementation of OpenGL, I use "Mesa 3D" open source library. Fortunately, Ubuntu offers "precompiled" mesa3d libraries (libgl1-mesa-dev and libglu1-mesa-dev) for Linux, but unfortunately, there are not any precompiled libraries for using with MinGW cross-compiler (thus Windows versions of them) - so I "MUST" manually compile them "from source" (which can be downloaded from http://www.mesa3d.org homepage).

But I have no idea to do that. Within the mesa3d source code, there are some documents how to build the libraries for some specific platforms - specifically there is "README.MINGW32" readme file.
But just on the first lines there is some command

mingw32-make -f Makefile.mgw [OPTIONS...]

which I cannot run because I don't have any "mingw32-make" program installed. By other softwares, I used to build them with the "classic"

./configure -> make -> make install

procedure, but this is not working on mesa3d libraries.
For example, I have also tried

./configure --host=i386-mingw32

and it has been configured ok but after typing

make

it threw some error

error: #error No PIPE_SUBSYSTEM_WINDOWS_xxx subsystem defined.

and now I am LOST :-( .

So does anybody know how to build the mesa3d libraries for using them with mingw32?

P.S.: And of course, I DON'T WANT to use Microsoft Visual Studio NEVER MORE :-) . And also I would like to do all the required things to build up OpenGL environment from Linux and using mingw32 for cross-compiling. I hope it is possible.

P.S.2: On http://www.mesa3d.org/systems.html page there is written that using MinGW with Mesa 3D is "deprecated". I am on the right way to use it just that way?

like image 866
Petike Avatar asked Jan 01 '10 19:01

Petike


People also ask

Does Mesa work on Windows?

Mesa is primarily developed and used on Linux systems. But there's also support for Windows, other flavors of Unix and other systems such as Haiku.

What is Mesa GPU?

Mesa, also called Mesa3D and The Mesa 3D Graphics Library, is an open source implementation of OpenGL, Vulkan, and other graphics API specifications. Mesa translates these specifications to vendor-specific graphics hardware drivers.

What is Mesa gallium?

Gallium is essentially an API for writing graphics drivers in a largely device-agnostic fashion. It provides several objects which encapsulate the core services of graphics hardware in a straightforward manner.


1 Answers

There is no need to compile Mesa3D for MinGW. MinGW includes the GL library; it's just not called libGL.a nor libGLU.a; the libraries are instead called libopengl32.a and libglu32.a. Sadly, this is what Microsoft decided to call them under Windows on Visual Studio, so both Windows and GNU/Linux release of MinGW decided to include the libraries named as above.

So, when cross compiling for Windows, just change:

-lGL -lGLU

into

-lopengl32 -lglu32

Mesa3D on GNU/Linux is actually a name for a libre implementation of OpenGL. This is because OpenGL is a trademark, and SGI's policy did not allow for anyone to use the name without paying a hefty sum of money. Despite this, SGI provided the author, Brian Paul, a copy of the testing suite.

Mesa3D is on most platforms with native OpenGL implementation known as a software "sanity check" library with emulation of numerous high-end-hardware-only features. But on GNU/Linux, much more important is something called DRI or direct rendering interface. This is the real deal, the hardware acceleration and all. This library is also called Mesa3D; in fact, provisioning for DRI is a part of Mesa3D as well as of X11 and the kernel.

Mesa3D provides libre OpenGL-compatible headers on GNU/Linux and other free platforms.

Summary: Mesa3D is the name for the GNU/Linux implementation of OpenGL since that name is trademarked. This library includes an excellent, featureful, correct and relatively fast software implementation. It also includes direct rendering interface for hardware acceleration.

like image 73
Ivan Vučica Avatar answered Oct 24 '22 22:10

Ivan Vučica