5 Microsoft Windows Specifics

5.010 What's a good source for Win32 OpenGL programming information?

See Blaine Hodge's web page. Be aware that this page shows usage of the AUX library, which is not recommended.

5.020 I'm looking for a Wintel OpenGL card in a specific price range, any suggestions?

The consumer-level 3D graphics marketplace moves fast. Any information placed in this FAQ would be soon outdated.

You might post a query on this topic to the comp.graphics.api.opengl newsgroup, or one of the many newsgroups devoted to Wintel-based 3D games. You might also do a Web search.

Tom's Hardware Guide and Fast Graphics have a lot of information on current graphics cards.

5.030 How do I enable and disable hardware rendering on a Wintel card?

Currently, OpenGL doesn't contain a switch to enable or disable hardware acceleration. Some vendors might provide this capability with an environment variable or software switch.

If you install your graphics card, but don't see hardware accelerated rendering check for the following:

  • Did you install the device driver / OpenGL Installable Client Driver (ICD)? (How do I do that?)
  • Is your desktop in a supported color depth? (Usually 16- and 32-bit color are accelerated. See your device vendor for details.)
  • Did your application select an accelerated pixel format?

You might also have acceleration problems if you're trying to set up a multimonitor configuration. Hardware accelerated rendering might not be supported on all (or any) devices in this configuration.

To temporarily disable hardware acceleration, move or rename your OpenGL ICD. Also, check your device's documentation to see if your device driver supports disabling hardware acceleration by a dialog box.

5.040 How do I know my program is using hardware acceleration on a Wintel card?

OpenGL doesn't provide a direct query to determine hardware acceleration usage. However, this can usually be inferred by using indirect methods.

If glGetString(GL_VENDOR) returns something other than "Microsoft Corporation", then you are using the board's ICD. If it returns "Microsoft Corporation", normally this implies you chose a pixel format that can't be accelerated by your device. However, this is also returned if your device has an MCD instead of an ICD, so you might still be hardware accelerated in this case.

Another way to check for hardware acceleration is to temporarily remove or rename the ICD, so it can't be loaded. If performance drops, you know that you were hardware accelerated before. Don't forget to put the ICD back the way it was.

You can also gather performance data by rendering into the back buffer and comparing the results against known performance statistics for your device. See the section on performance for more information.

5.050 Where can I get the OpenGL ICD for a Wintel card?

If your device supports OpenGL, the manufacturer should provide an ICD (commonly referred to as the device driver) for it. After you install the ICD, your OpenGL application can use the device's hardware capabilities.

If your device didn't come with an ICD on disk, you'll need to check the manufacturer's Web page to see where you can download the latest drivers. The chip manufacturer will probably have a more current ICD than the board manufacturer. Find the device driver download page, get the latest package for your device, and install it per the instructions provided.

Check Reactor Critical for nVidia device drivers. They often have more current and better performing OpenGL device drivers than nVidia makes available from their web page.

GLsetup, a free utility, is available. According to the GLsetup Web page, it "detects a user's 3D graphics hardware and installs the correct device drivers." You can get it from http://www.glsetup.com.

5.060 I'm using a Wintel card, and an OpenGL feature doesn't seem to work. What's going on?

It could simply be a bug in your code. However, if the same code works fine on another OpenGL implementation, this implies the problem is in your graphics device or its ICD. See the previous question for information on obtaining the latest ICD for your device.

5.070 Can I use OpenGL with DirectDraw?

This won't work on some drivers, and is therefore unportable. I don't recommended it.

5.080 Can I use use DirectDraw to change the screen resolution or desktop pixel depth?

This probably depends on your graphics device and what, if any, support for this type of operation your device driver provides. You need to keep this basic tenet in mind: Microsoft doesn't require, and consequently does not test for, the ability to render OpenGL into a DirectDraw surface. For this reason, you shouldn't expect this window creation strategy to be available.

5.090 My card supports OpenGL, but I don't get acceleration regardless of which pixel format I use.

Are you in 8bpp?  There are few 3D accelerators for PCs that support acceleration in 8bpp.

5.100 How do I get hardware acceleration?

The pixel format selects hardware acceleration.  Pay attention to the flags GENERIC_FORMAT and GENERIC_ACCELERATED. You want both of them on if you're using a 3D-DDI or an MCD and neither on if you are using an ICD.  You may have to iterate using DescribePixelFormat() instead of only using ChoosePixelFormat().

5.110 Why doesn't OpenGL hardware acceleration work with multiple monitors?

In Windows 98, Microsoft decided to disable OpenGL hardware acceleration when multiple monitors are enabled.  In Windows NT 4.0, some drivers support multiple monitors when using identical (or nearly identical) cards. I don't believe multiple monitors and hardware accelerated OpenGL work with different types of cards.  I don't know the story with Windows 2000, but it's likely to be similar to Windows NT 4.0.

5.120 Why does my MFC window flash, even though I'm using double buffering?

Your view class should have an OnEraseBackground() event handler, which should do nothing other than return TRUE. This tells Windows that you've cleared the window. Of course, you didn't really clear the window. However, returning TRUE keeps Microsoft from trying to do it for you, and should prevent flashing.

5.130 What's the difference between opengl.dll and opengl32.dll?

According to OpenGL Reference Manual editor Dave Shreiner:

"Unless there's an absolutely compelling reason ... I really would suggest using opengl32.dll, and letting the old opengl.dll thing die.

"opengl.dll comes from the now totally unsupported OpenGL for Windows release of OpenGL for Microsoft Windows by SGI.  We stopped supporting that release over two years -- like no one ever touches the code. ...

"Now, why use opengl32.dll?  For the most part, SGI provides Microsoft with the ICD kit, sample drivers, and software OpenGL implementation that you find there.  Its really the same code base (with fixes and new features) as the opengl.dll, its only that we got Microsoft to ship and support it (in a manner of speaking)."

More information on linking with opengl.dll can be found here.

5.140 Should I use Direct3D or OpenGL?

A good comparison of the two can be found here.