glut problem

I am a beginner, obviously. When I tried to run my very first program (which is actually a sample code I found in the internet) in vc++ everything compiled fine with no errors. But, when I tried to run to program I got from the executable dos window
“glut:C:…(the location): pixel format with necessary capabilities not found”.
May somebody help me fix this please! thank you!
Evans

It seems that you have not installed your graphics card.

What pixel format does that program need ?

your best choice is to go your graphics card’s homepage (www.nvidia.com, etc) and download the newest driver for windows.

If that doesn’t work, then your graphics card is probably no good (or something else is seriously wrong).

Is your graphics burned on to the motherboard? I am coming across the exact same GLUT error message on a P4 Dell PC using an Intel 945G driver running a fog program in color-index mode. This PC has the graphics burned on to the motherboard.

It could be the graphics chipset drivers may be incapable of color-index mode.

In addition, you may want to plant some printf functions or use cout statements in the code to trap which GLUT function is causing the problem.

When I did this, the problem was at the following statement in the main function:
glutCreateWindow(argv[0]);

glutCreateWindow() appears to cause problems regardless of what type PC is running it.

It seems Win32 doesn’t appear to have this problem because it has functions capable of color-index mode because of the pixel format descriptor.

I’ll need to check further and see if GLUT has a capability to develop a pixel format descriptor before creating a window.

OK, I have found a solution to the GLUT problem with glutCreateWindow().

It appears when attempting to run a program in color-index mode, the color quality in Windows can impact the success of glutCreateWindow. If the color quality settings are set to High (32-bit), the program will fail with the “GLUT: Fatal Error … pixel format with necessary capabilities not found.”

One workaround is to code the program in Win32 fashion and specify a PIXELFORMATDESCRIPTOR (HIGHLY TECHNICAL).

A second workaround is to set glutInitDisplayMode() to GLUT_RGB. This will cause GLUT to issue warnings and will allow the color-index commands to work.

A third workaround is to set the color quality settings down to Medium (16-bit) or lower in the Windows display settings. This is the most minimally invasive method because once the setting is changed, the program can be run without a need to recompile.

If you use the third method, remember to return the color quality settings back to where they were.

Hmmmm… with glut you get to request the framebuffer attributes. For example:

glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

It is perfectly possible to request display attributes that aren’t supported by your hardware.

I’d avoid color index mode altogether, it is archaic and offers no real advantages for most people. In addition combinations of attributes may just not be available in which case you should try to modify what you request. It is possible to request all sorts of things using GLUT, like RGB, accumulation, stencil, depth, stereo. So take a look at what you’re requesting. You could also try to write fallback software for when your request doesn’t work. glutCreateWindow has a return value and failing does’t mean you have to bail on your program (AFAIK).

GLUT hides stuff like pixelformatdescriptor details, that’s the whole point, it abstracts away platform details, but you can’t just assume that the visual attributes you request will be honored, and it’s not always because you have no graphics drivers installed, often it’s because your request was too ambitious or used deprecated features or maybe just requested a strange combination of features.

When you have an RGB display color index commands won’t work, they’ll be called but I doubt anything good will happen, you should port the index code, you’re probably missing a bunch of glerrors that are being generated.