Test for hardware compatibility

I was wondering how I can test if the user’s hardware supports, for example, stencil buffers and other rendering functions.

Thanx !

–>Divide

OpenGL has no direct method of determining what features are hardware accelerated, like the stencil buffer for example. All you can really do is first request the feature, say for example 8 bits for stencil in the pixel format. If you are then given the 8 bits of stencil, you can then run a performance test to determine if it is in fact accelerated. I would then simply store the test results along with the glStrings in a config file. Then whenever the program starts again, it can check the strings to see if they are the same as what was stored. If they are the same use the results of previous performance test, otherwise, retest. Another approach is to simply build a database of video cards and their respective features (easy said than done) and use the GL_RENDERER string as an index into the database. Or if you are using Windows, you might try using DirectX’s capbits to determine hardware features, but those results would not ensure the hardware was implemented in any particular version of the video cards OpenGL ICD. I wish video card vendors would create a capbits OpenGL extension, then this would be trivial (as long as the bits were correct).

[This message has been edited by DFrey (edited 07-23-2000).]

[This message has been edited by DFrey (edited 07-23-2000).]

Thanx !

This is true, but many implementations won’t support stencil if it’s not in hardware, so, yes a performance test may be worth if for some stuff, often you won’t get the software fallback in this case.

For stencil, simply requesting the visual attribute and seeing if you got the visual will usually be enough. The API veries from platform to platform but use the usual itterative method of requesting a visual.