[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Parsing OpenGL extensions string



Miguel A. Osorio wrote:
Hey people,


I recently downloaded a GDC presentation by Mark Kilgard on OpenGL extensions, and there's a section on using extensions. Run-time checking of extensions is done by searching inside the string returned by glGetString(GL_EXTENSIONS), but Kilgard advises *not* to use the standard function "strstr", using instead glutExtensionSupported or other routine.

What would be the problem using strstr?
I believe the problem was when the first characters of one extension matched
the whole of another extension.

eg If you were searching for "glWidget" and your card only supported "glWidget_NV", a
   naive strstr would report that the card had the extension - when in fact it
   doesn't.

I forget which specific extension was exhibiting the problem - but you can see the
obvious scope for problems.

-----------------------------------------------------------------------
The second law of Frisbee throwing states: "Never precede any maneuver
by a comment more predictive than "Watch this!"...it turns out that
this also applies to writing Fragment Shaders.
-----------------------------------------------------------------------
Steve Baker                      (817)619-2657 (Vox/Vox-Mail)
L3Com/Link Simulation & Training (817)619-2466 (Fax)
Work: sjbaker@link.com           http://www.link.com
Home: sjbaker1@airmail.net       http://www.sjbaker.org