Hello, I’m new here!

Anyways, I’m currently in University and we use GNU C/C++ to do most of our assignments. I want to start learning about 3d programming and I was just wondering if I could use the OpenGL to create graphics using GNU C\C++? There’s a graphics library called Allegro taht I was playing around with once, but I want to learn OpenGL. If someone can explain to me how I can get started I’d appreciate it.

What platform are you using that on? The university I graduated from had RedHat Linux installed on some machines, and they actually had the OpenGL headers and libraries installed. I think the only reason they were installed was because the graphics programming class used VTK, which I think might rely on OpenGL underneath. Anyway, if you are on a Linux platform do something like so to find out if the OpenGL libraries are present…

locate libGL
locate gl.h

Or try and look in /usr/include/GL, /usr/lib, etc…

At home, I have a Suse box and I had to grab all the OpenGL development packages and setup the nVidia graphics drivers. (My Linux box has a GeForce 256)

on Linux you have free OGL implementation called Mesa (; and on Windows you have nicely GNU C/C++ port called MinGW (
In MinGW case, you get needed OGL libray, only you need to download .h files (they can be found on the net).
Also if you want to use Mesa on win, compiling will be easy with MinGW.


For a good (?) overview of compilers and OpenGL drivers for Windows and Unix (e.g. Linux) go to I use MinGW (GNU C/C++) under Windows. On the page you will find OpenGL includes that work with MinGW. You can also use Cygwin (another GNU C/C++ port for Windows) if you want.

If you’re just getting started with OpenGL, also check out GLFW , which is very helpful for setting up an OpenGL display.
Most Linux distributions come with Mesa 3D (an OpenGL work-alike implemented in software), but there are also hardware accelerated OpenGL implementations available for Linux (see the drivers section on the above mentioned page).

Hi !

Are you using GNU C++ on Linux/UNIX or on Windows (MinGW32) ?


I’m using it on Windows.

When I take a course on computer graphics next year I’ll be using it on Unix, but I want to learn some stuff on my own over the summer.

Ok, so the next question would be how are you using it in Windows. Mingw, Cygwin, or some other way?

Cygwin comes with the OpenGL headers, but if I remember right, you have to build the libraries from the DLL. (And I can’t remember how to do that offhand.)

I compile my code in DOS.

Ok, well… Here’s the problem… DOS doesn’t come with a GNU compiler. There are a number of implementations of GNU compilers for Windows. Each of these implementations has somewhat unique characteristics when it comes to libraries and headers available. In order to help you setup GNU to compile OpenGL, we need to know what implementation you are using.

For Windows, you can choose either MinGW32 or Cygwin . I use MinGW (the primary reason is that it generates native Windows executables, whereas Cygwin compiled executables need a special DLL).

Cygwin comes with both libraries and headers for OpenGL (at least I was able to compile OpenGL programs with Cygwin without doing anything special).

MinGW comes with the libraries, but not the headers at the moment. Soon there will be OpenGL 1.3 headers included in the MinGW distribution, but for now you can find headers here .

For DOS (now I’m talking about pure MS-DOS, not a command prompt under Windows), there is DJGPP. It generates 32-bit DOS programs. I’m not sure if you can write win32 programs with it, or use win32 DLLs (e.g. opengl32.dll). AFAIK the only way to run OpenGL apps under DOS is to use Mesa3D (which has a DOS driver).

Just to clarify: both the Cygwin and MinGW32 versions of gcc are accessed from a Windows command prompt (or MS-DOS prompt). This does NOT mean that they are DOS programs though (they will not run under DOS, only under Windows).

[This message has been edited by marcus256 (edited 04-18-2002).]

Yeah, I’m using DJGPP in DOS. Sorry, I’m not 100% familiar with all the terminology.