Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
103 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Introduction
 The Problem
 The Solution
 Using the
 OpenGL Module


 Printable version

 


The Solution

The solution to this problem is *NOT* to bind your program to OpenGL32.lib. Instead you must manually load the correct driver - either 3dfxvgl.dll in the case of a Voodoo1 or Voodoo2 card or opengl32.dll in the case of everything else.

The Details

When I sat down to make this whole process work for my Azteroidz game, there were a few things that I wanted:

  1. I wanted to continue to use the standard gl.h include file thus guaranteeing that I will not fall victim to stupid typos or other ills of that nature, and at the same time ensuring that updating to support a new OGL revision would be as easy as adding a few function calls without worrying about header files.
  2. I wanted to change my existing OpenGL application (Azteroidz3D) as little as possible.
  3. I wanted to support both MiniGL (the subset of OpenGL that Quake1/2 based games use) and full ICD's, software OGL and everything in between. Admittedly theres pretty much zero reason to be using MiniGL anymore (unless you're really hung up on supporting PowerVR cards like the Matrox M3D) - but its still lurking in my code for legacy reasons.

So I banged out some code, it seemed to work, and I released a new version of Azteroidz. Shortly thereafter the problem emails started trickling back, it seems I had overlooked something. That something was the fact that some GDI calls (SwapBuffers for example) themselves call WGL OpenGL functions internally. Therefore if you are using a OpenGL driver named opengl32.dll you must call the GDI functions, and if you are not using a driver named opengl32.dll you must NOT call the GDI functions.

The Source code:

OpenGL.h
OpenGL.c

For the latest code, go here.


Next : Using the OpenGL Module