Game Development Community

Bug in winGL.cc

by Alex Scarborough · in Torque Game Engine · 03/21/2006 (11:05 pm) · 0 replies

This just about drove me to insanity. If you've ever tried to use glBlendEquationEXT under Windows, you've probably noticed that it doesn't work. Here's why.

winGL.cc, around line 439.
// EXT_blend_minmax
   if(pExtString && dStrstr(pExtString, (const char*)"GL_EXT_blend_minmax") != NULL)
   {
      extBitMask |= EXT_blend_color;
      gGLState.suppEXTblendminmax = true;
   } else {
      gGLState.suppEXTblendminmax = false;
   }

This code inits glBlendColorEXT again if we support GL_EXT_blend_minmax. Bad code. Here's the fix.
// EXT_blend_minmax
   if(pExtString && dStrstr(pExtString, (const char*)"GL_EXT_blend_minmax") != NULL)
   {
      extBitMask |= EXT_blend_minmax; // Load the functions associated with EXT_blend_minmax
      gGLState.suppEXTblendminmax = true;
   } else {
      gGLState.suppEXTblendminmax = false;
   }

This inits glBlendEquationEXT if GL_EXT_blend_minmax is supported. Good code.