OpenGL, Mingw32 and Allegro  

OpenGL, Mingw32 and Allegro + DirectX

All my work here is in the Public Domain (PD). It has no warranties whatsoever. Use at your own risk!

The pages here is mainly for Mingw32 but I also put up a page for Borland's free compiler .
It seems like the links is not correct if you use the history function of MS Internet Explorer.

Mingw32, editors and OpenGL

Mingw32 is a port of the well known gcc compiler to windows. Mumit Khan is the maintainer and you can get it from his  page.
An easy to use editor is  programmer's file editor pfe that can be used together with  rsxide if you don't want to write makefiles.
A much more powerful but weird and hard to learn editor is  ntemacs this version is also for win9x systems.
Another alternative is  VIDE  this is the one to pick if you want to use the V  library.
The current mingw32 version gcc-2.95.2 does not have the include headers for OpenGL but the ones for MSVC seems to work, they are in this package from  microsoft.
Create a directory GL in the include directory and put the headers in this directory. The exact location depends on the version of mingw32 and install dir but one example is C:\GCC-2.95.2\i386-mingw32msvc\include\GL .
Make sure that C:\WINDOWS\SYSTEM has the files opengl32.dll and glu32.dll.
You can compile OpenGL programs from the DOS prompt (in windows!) in this way : gcc myglprog.c -mwindows -lopengl32 -lglu32

GLUT and other libraries

Almost all libraries have import libraries only for the  Microsoft compiler but the tool reimp can convert them to mingw32 format. This tool is currently not in the mingw32 package but is available from  Anders Norlander.

GLUT is very interesting for all OpenGL developers. If you are interested so take a look at my  GLUT with Mingw32  page.

Instead of GLUT can you try  SDL or the powerful  allegro  library (get the most recent WIP). Allegro is the most complex of them with a lot of functions and tools take a look at the Allegro+OpenGL page if you want to combine them.
Graphic interfaces is object oriented by nature so it is a good idea to use  inheritance in GUI programs. Borland have VCL and before that OWL and Microsoft has MFC for Mingw32 is  V  and  wxWindows  the most popular. You will also get code that works on several platforms but still looks and feel like a windows program. I think that both have additional functions for extended OpenGL support.
The difference between V and wxWindows seems to be that wxWindows is bigger and more ambitious.

A page for  Windows Multimedia  and some information about  Windows resources and windres  is also available.
DirectX is supporting hardware acceleration for 2D but not all systems have DirectX installed so the application has to use the old GDI library. Mingw32 comes with the necessary include and library files for GDI but if you do not use a library like Allegro that take care of the switching between GDI and DirectX do you have to write code for this.
Microsoft has  GDI documentation and  examples  on MSDN and I got some makefiles for Mingw32.

A quick and dirty loader for OpenGL extension functions

I made a page about how you can get the latest OpenGL functions and a little library called QDGL to do that.
 

NeHe tutorials

The coolest OpenGL tutorials is the ones at  NeHe productions!

Here is the code for mingw32 I have converted the first 30 examples the actual tutorials is available at the NeHe  page  for viewing online or downloading.
Many of  the samples has been modified at the NeHe page but not here. Combine the tutorials with the red book (see GLUT page) for best results!
Allegro is used to load and convert bitmaps in the examples 6-12 , 15-24 and lesson 27, 29.
Download the latest  WIP  and follow the instructions in the file "readme.mgw" to build allegro.
.
  1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20

They can also be compiled using another compiler with allegro but the makefiles is for mingw32.
You must have DirectX 7 or higher for mingw32 if you want to compile example 23. It is on my  DirectX page.
 
 21
 22
 23
 24
 25
 26
 27
28
29
 30

The latest tutorials is not using the glaux library and can be built with any ANSI C++ compiler. I guess that the reason to port them does not exist any longer so I have decided to stop.
If you want to do examine the original tutorials do you need glaux. You can get it from Ronald Praver's page and here is a gcc makefile
Use the code for Visual C++ in the future. In case of problems can you take a look how it is done  in the samples above.

Jeff & friends is doing a excellent work getting the tutorials as standard as possible so you should not have any problems.
I have some makefiles for the mingw snapshot available from Mingw home page.

Hacked version of the NeHe framework using different fullscreen modes

NeHe tutorial 5 with a different framework

GLUT with DirectInput example

NeHe tutorial 23 with both native GLUT input functions and Win32API/DirectInput.

NeHe's shadow volume tutorial with the rtshadow library

An easier way to do shadow volumes is by using Mark Kilgards library rtshadow. I used it to test an alternative to tutorial 28.

Another version of NeHes shadow volume tutorial demonstrating Carmack's reverse

The program can also try to pick the best one. Download it and see how Carmack's reverse can improve your shadows.

My OpenGL port of the Direct3D sample "Boids"

The port is using GLUT and Allegro. I called it GLboids.

A little GLE program

A simple tunnel ride program that uses the GLE library.
 

Simple example of dynamic sphere maps

You are a red ball that moves around in this hacked NeHe 10 GLUT port. Take a look at your reflection in the sphere.

About using wrappers

I recommend several wrappers like Allegro, GLUT and others but do not forget that wrappers has some drawbacks. You do not get all functions and documentation is not always up to date. In case of new releases do you have to wait until you eventually can use the new functions. Wrappers are often not as well tested and can introduce new errors. The good stuff is that they are easier to use and portable. Do not use any wrappers that you do not have the source code for. If Windows is the only target platform and the project is big is it perhaps better to use native functions.

Kenny Hoff's real-time realistic lighting effects

Also lot of other stuff with makefiles for MinGW. Really cool, take a look here.

OpenGL and linux

OpenGL and linux is a good combination. Visit my  OpenGL and linux page .

Misc. links

opengl.org   is the best place to start with for OpenGL related material
NVIDIA has an excellent developer page, a must!   ATI has also a lot of OpenGL related stuff.
MSDN is the primary source for all windows programmers, lots of interesting articles and other stuff. Great place to browse around at.
Windows tutorials another from Reliable Software  and finally some pretty ambitious
Bloodshed  has some stuff like an installer program, maker of the Dev-C++ IDE for Mingw32.
Many utilities  found on the internet can be of good use.
Microsoft Platform SDK  has some great stuff like documentation for Windows Multimedia, GDI and OpenGL. The documentation for OpenGL is more useful as a reference than for learning but covers the implementation specific details.
Microsoft Platform SDK documentation here can you pick them
Bruce Eckel's books like "Thinking in C++" is available for download
Microsoft tools for help files  can beuseful for documentation purposes

Bill Gates as a  borg , MS NT and MS & Apple
MS support, standards and .net

I really doesn't have time to answer any questions but here is a email address