On Thu, 9 Sep 1999, Thomas Roell wrote:

> >     Also, an emerging use of wglGetProcAddress() is to return pointers
> > to OpenGL 1.2 core functions. While this exact scenario is unlikely to
> > arise on Linux, we should still be very clear up front about whether
> > non-EXT functions can be queried.
> 
> Please let's avoid this. It would be intresting to know as to why
> people are using this approach.
 
<sigh> I seem to have spent all day patiently explaining this.

A Story.
~~~~~~~~

One bright summer morning, the ARB pronounces the existance of
OpenGL 1.3.  It adds "glRealisticShadowsForFree()".

Two days later the OpenSource guys have implemented it on Mesa
and we have a usable OpenGL 1.3.

*  50% of Linux users read about it on Slashdot download it
   immediately - flooding the www.mesa3D.org server.

*  1% of them are running XiG OpenGL 1.2 and they get an OpenGL 1.3
   upgrade (let's be generous) a month later.

*  49% of Linux users install RedHat 8.9 six months later and
   *STILL* have OpenGL 1.2.

OK, I'm writing a new game.  I'd like to use glRealisticShadowsForFree.

What do I do?

If glGetFuncAddress is defined to return valid results for gl*
calls, I can say:

     glGetString ( GL_VERSION ) ;
     ...parse string...

     if ( we_are_gl_1_point_3 )
       shadows = glGetFuncAddress ( "glRealisticShadowsForFree" ) ;
     else
       shadows = NULL ; /* Doesn't exist in OpenGL 1.2 :-(  */

     ...later...

     if ( shadows != NULL )
       (*shadows)() ;

...if glGetFuncAddress is defined NOT to return gl* (non-extension)
addresses (for some unfathomable reason, 80% of the people on this
list have been asking for it to work in this crippled way)

THEN, all I can do is this:

   #ifdef GL_VERSION_1_3
      glRealisticShadowsForFree() ;
   #else
      /* Tough luck */
   #endif

...which means that I either have to hold off shipping my game
until OpenGL 1.3 finally makes it onto 90% of the computers in
the world...OR...I have to ship two binaries - one for OpenGL
1.2 and another for 1.3 (and eventually, yet another for 1.4...)
...OR...I could do the disgusting Windoze trick of using dlopen/dlsym.

But, the last option is out because:

    "We Are Not At Home To Mr Kludge Today"

OK.

Now, will *SOMEONE* give me ANY REASON why it's bad to have
glGetFuncAddress return the address of a regular gl* function.

So far, I have two possible reasons:

* This morning someone said the lookup table would be too big.
     I computed it - it's ~5kbytes longer if you do it the
     naive { "glBegin", glBegin }  way, ~2kbytes if you go
     for a clever hashtable approach so glGetFuncAddress is
     **FAST**.
     Either way makes libMesaGL about a half percent larger
     overall.

* It'll take poor Brian too long to type in all those function
  names tonight when he implements it.

I'm betting it's the second reason - and I sympathise.

Steve Baker                (817)619-2657 (Vox/Vox-Mail)
Raytheon Systems Inc.      (817)619-2466 (Fax)
Work: [EMAIL PROTECTED]      http://www.hti.com
Home: [EMAIL PROTECTED] http://web2.airmail.net/sjbaker1

Reply via email to