]> OCCT Git - occt.git/commitdiff
0032082: Visualization, TKOpenGl - improve formatting of error messages
authorkgv <kgv@opencascade.com>
Sat, 23 Jan 2021 18:35:46 +0000 (21:35 +0300)
committerkgv <kgv@opencascade.com>
Sun, 24 Jan 2021 20:48:10 +0000 (23:48 +0300)
Error messages in TKOpenGl package have been improved to format
GLenum values as string constants or hex values.
OpenGl_VertexBuffer::init() now logs a message with error details
instead of just returning Boolean flag.

14 files changed:
src/OpenGl/OpenGl_Context.cxx
src/OpenGl/OpenGl_Context.hxx
src/OpenGl/OpenGl_GlCore11.hxx
src/OpenGl/OpenGl_GlCore11Fwd.hxx
src/OpenGl/OpenGl_GlFunctions.hxx
src/OpenGl/OpenGl_SceneGeometry.cxx
src/OpenGl/OpenGl_Texture.cxx
src/OpenGl/OpenGl_TextureFormat.cxx
src/OpenGl/OpenGl_TextureFormat.hxx
src/OpenGl/OpenGl_TileSampler.cxx
src/OpenGl/OpenGl_VertexBuffer.cxx
src/OpenGl/OpenGl_VertexBuffer.hxx
src/OpenGl/OpenGl_View.cxx
src/Standard/Standard_TypeDef.hxx

index 097e12fefe943032e3dd0657529c36ed45ce8d82..16c68647c4bfd7b2afed8e83e71efb1d8f602df2 100644 (file)
 #include <Standard_ProgramError.hxx>
 #include <Standard_WarningDisableFunctionCast.hxx>
 
+#if defined(_WIN32) && defined(max)
+  #undef max
+#endif
+#include <limits>
+
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Context,Standard_Transient)
 
 #if defined(HAVE_EGL)
@@ -1004,6 +1009,62 @@ Standard_Boolean OpenGl_Context::Init (const Aspect_Drawable         theWindow,
   return Standard_True;
 }
 
+// =======================================================================
+// function : FormatGlEnumHex
+// purpose  :
+// =======================================================================
+TCollection_AsciiString OpenGl_Context::FormatGlEnumHex (int theGlEnum)
+{
+  char aBuff[16];
+  Sprintf (aBuff, theGlEnum < (int )std::numeric_limits<uint16_t>::max()
+                ? "0x%04X"
+                : "0x%08X", theGlEnum);
+  return aBuff;
+}
+
+// =======================================================================
+// function : FormatSize
+// purpose  :
+// =======================================================================
+TCollection_AsciiString OpenGl_Context::FormatSize (Standard_Size theSize)
+{
+  char aBuff[32];
+  Sprintf (aBuff, "%" PRIu64, (uint64_t )theSize);
+  return aBuff;
+}
+
+// =======================================================================
+// function : FormatPointer
+// purpose  :
+// =======================================================================
+TCollection_AsciiString OpenGl_Context::FormatPointer (const void* thePtr)
+{
+  char aBuff[32];
+  Sprintf (aBuff, "0x%" PRIXPTR, (uintptr_t )thePtr);
+  return aBuff;
+}
+
+// =======================================================================
+// function : FormatGlError
+// purpose  :
+// =======================================================================
+TCollection_AsciiString OpenGl_Context::FormatGlError (int theGlError)
+{
+  switch (theGlError)
+  {
+    case GL_INVALID_ENUM:      return "GL_INVALID_ENUM";
+    case GL_INVALID_VALUE:     return "GL_INVALID_VALUE";
+    case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION";
+  #ifdef GL_STACK_OVERFLOW
+    case GL_STACK_OVERFLOW:    return "GL_STACK_OVERFLOW";
+    case GL_STACK_UNDERFLOW:   return "GL_STACK_UNDERFLOW";
+  #endif
+    case GL_OUT_OF_MEMORY:     return "GL_OUT_OF_MEMORY";
+    case GL_INVALID_FRAMEBUFFER_OPERATION: return "GL_INVALID_FRAMEBUFFER_OPERATION";
+  }
+  return FormatGlEnumHex (theGlError);
+}
+
 // =======================================================================
 // function : ResetErrors
 // purpose  :
@@ -1024,29 +1085,40 @@ bool OpenGl_Context::ResetErrors (const bool theToPrintErrors)
 
   for (; anErr != GL_NO_ERROR && aPrevErr != anErr; aPrevErr = anErr, anErr = ::glGetError())
   {
-    TCollection_ExtendedString anErrId;
+    const TCollection_ExtendedString aMsg = TCollection_ExtendedString ("Unhandled GL error: ") + FormatGlError (anErr);
+    PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 0, GL_DEBUG_SEVERITY_LOW, aMsg);
+  }
+  return hasError;
+}
+
+// =======================================================================
+// function : debugPrintError
+// purpose  :
+// =======================================================================
+bool OpenGl_GlFunctions::debugPrintError (const char* theName) const
+{
+  const int anErr = ::glGetError();
+  if (anErr != GL_NO_ERROR)
+  {
+    Message::SendFail() << theName << "(), unhandled GL error: " << OpenGl_Context::FormatGlError (anErr);
+    // there is no glSetError(), just emulate non-clear state
     switch (anErr)
     {
-      case GL_INVALID_ENUM:      anErrId = "GL_INVALID_ENUM";      break;
-      case GL_INVALID_VALUE:     anErrId = "GL_INVALID_VALUE";     break;
-      case GL_INVALID_OPERATION: anErrId = "GL_INVALID_OPERATION"; break;
-    #ifdef GL_STACK_OVERFLOW
-      case GL_STACK_OVERFLOW:    anErrId = "GL_STACK_OVERFLOW";    break;
-      case GL_STACK_UNDERFLOW:   anErrId = "GL_STACK_UNDERFLOW";   break;
-    #endif
-      case GL_OUT_OF_MEMORY:     anErrId = "GL_OUT_OF_MEMORY";     break;
-      case GL_INVALID_FRAMEBUFFER_OPERATION:
-        anErrId = "GL_INVALID_FRAMEBUFFER_OPERATION";
+      case GL_INVALID_VALUE:
+      {
+        ::glLineWidth(-1.0f);
+        ::glLineWidth( 1.0f);
         break;
+      }
       default:
-        anErrId = TCollection_ExtendedString("#") + anErr;
+      case GL_INVALID_ENUM:
+      {
+        ::glEnable (0xFFFF);
         break;
+      }
     }
-
-    const TCollection_ExtendedString aMsg = TCollection_ExtendedString ("Unhandled GL error: ") + anErrId;
-    PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 0, GL_DEBUG_SEVERITY_LOW, aMsg);
   }
-  return hasError;
+  return anErr != GL_NO_ERROR;
 }
 
 // =======================================================================
index 493a10e7650e1c33b80f61db43c88ffbfbbb0612..3c25ca97d4520a9b22ada17f4c47a4b244d48747 100644 (file)
@@ -232,6 +232,18 @@ public:
     return theThreshold;
   }
 
+  //! Format GL constant as hex value 0xABCD.
+  Standard_EXPORT static TCollection_AsciiString FormatGlEnumHex (int theGlEnum);
+
+  //! Format pointer as hex value 0xABCD.
+  Standard_EXPORT static TCollection_AsciiString FormatPointer (const void* thePtr);
+
+  //! Format size value.
+  Standard_EXPORT static TCollection_AsciiString FormatSize (Standard_Size theSize);
+
+  //! Return text description of GL error.
+  Standard_EXPORT static TCollection_AsciiString FormatGlError (int theGlError);
+
 public:
 
   //! Empty constructor. You should call Init() to perform initialization with bound GL context.
index e4eadd4de06b1fa50bae499b6796e0c3f43c4063..eeb916030f51fb942b47cc0b501a9a44d9af9181 100644 (file)
@@ -30,16 +30,19 @@ struct OpenGl_GlCore11 : protected OpenGl_GlFunctions
                          GLdouble theX, GLdouble theY, GLdouble theZ)
   {
     ::glRotated (theAngleDegrees, theX, theY, theZ);
+    OpenGl_TRACE(glRotated)
   }
 
   inline void glScaled (GLdouble theX, GLdouble theY, GLdouble theZ)
   {
     ::glScaled (theX, theY, theZ);
+    OpenGl_TRACE(glScaled)
   }
 
   inline void glTranslated (GLdouble theX, GLdouble theY, GLdouble theZ)
   {
     ::glTranslated (theX, theY, theZ);
+    OpenGl_TRACE(glTranslated)
   }
 
 public: //! @name Begin/End primitive specification (removed since 3.1)
@@ -47,551 +50,661 @@ public: //! @name Begin/End primitive specification (removed since 3.1)
   inline void glBegin (GLenum theMode)
   {
     ::glBegin (theMode);
+    OpenGl_TRACE(glBegin)
   }
 
   inline void glEnd()
   {
     ::glEnd();
+    OpenGl_TRACE(glEnd)
   }
 
   inline void glVertex2d (GLdouble theX, GLdouble theY)
   {
     ::glVertex2d (theX, theY);
+    OpenGl_TRACE(glVertex2d)
   }
 
   inline void glVertex2f (GLfloat  theX, GLfloat  theY)
   {
     ::glVertex2f (theX, theY);
+    OpenGl_TRACE(glVertex2f)
   }
 
   inline void glVertex2i (GLint    theX, GLint    theY)
   {
     ::glVertex2i (theX, theY);
+    OpenGl_TRACE(glVertex2i)
   }
 
   inline void glVertex2s (GLshort  theX, GLshort  theY)
   {
     ::glVertex2s (theX, theY);
+    OpenGl_TRACE(glVertex2s)
   }
 
   inline void glVertex3d (GLdouble theX, GLdouble theY, GLdouble theZ)
   {
     ::glVertex3d (theX, theY, theZ);
+    OpenGl_TRACE(glVertex3d)
   }
 
   inline void glVertex3f (GLfloat  theX, GLfloat  theY, GLfloat  theZ)
   {
     ::glVertex3f (theX, theY, theZ);
+    OpenGl_TRACE(glVertex3f)
   }
 
   inline void glVertex3i (GLint    theX, GLint    theY, GLint    theZ)
   {
     ::glVertex3i (theX, theY, theZ);
+    OpenGl_TRACE(glVertex3i)
   }
 
   inline void glVertex3s (GLshort  theX, GLshort  theY, GLshort  theZ)
   {
     ::glVertex3s (theX, theY, theZ);
+    OpenGl_TRACE(glVertex3s)
   }
 
   inline void glVertex4d (GLdouble theX, GLdouble theY, GLdouble theZ, GLdouble theW)
   {
     ::glVertex4d (theX, theY, theZ, theW);
+    OpenGl_TRACE(glVertex4d)
   }
 
   inline void glVertex4f (GLfloat  theX, GLfloat  theY, GLfloat  theZ, GLfloat  theW)
   {
     ::glVertex4f (theX, theY, theZ, theW);
+    OpenGl_TRACE(glVertex4f)
   }
 
   inline void glVertex4i (GLint    theX, GLint    theY, GLint    theZ, GLint    theW)
   {
     ::glVertex4i (theX, theY, theZ, theW);
+    OpenGl_TRACE(glVertex4i)
   }
 
   inline void glVertex4s (GLshort  theX, GLshort  theY, GLshort  theZ, GLshort  theW)
   {
     ::glVertex4s (theX, theY, theZ, theW);
+    OpenGl_TRACE(glVertex4s)
   }
 
   inline void glVertex2dv (const GLdouble* theVec2)
   {
     ::glVertex2dv (theVec2);
+    OpenGl_TRACE(glVertex2dv)
   }
 
   inline void glVertex2fv (const GLfloat*  theVec2)
   {
     ::glVertex2fv (theVec2);
+    OpenGl_TRACE(glVertex2fv)
   }
 
   inline void glVertex2iv (const GLint*    theVec2)
   {
     ::glVertex2iv (theVec2);
+    OpenGl_TRACE(glVertex2iv)
   }
 
   inline void glVertex2sv (const GLshort*  theVec2)
   {
     ::glVertex2sv (theVec2);
+    OpenGl_TRACE(glVertex2sv)
   }
 
   inline void glVertex3dv (const GLdouble* theVec3)
   {
     ::glVertex3dv (theVec3);
+    OpenGl_TRACE(glVertex3dv)
   }
 
   inline void glVertex3fv (const GLfloat*  theVec3)
   {
     ::glVertex3fv (theVec3);
+    OpenGl_TRACE(glVertex3fv)
   }
 
   inline void glVertex3iv (const GLint*    theVec3)
   {
     ::glVertex3iv (theVec3);
+    OpenGl_TRACE(glVertex3iv)
   }
 
   inline void glVertex3sv (const GLshort*  theVec3)
   {
     ::glVertex3sv (theVec3);
+    OpenGl_TRACE(glVertex3sv)
   }
 
   inline void glVertex4dv (const GLdouble* theVec4)
   {
     ::glVertex4dv (theVec4);
+    OpenGl_TRACE(glVertex4dv)
   }
 
   inline void glVertex4fv (const GLfloat*  theVec4)
   {
     ::glVertex4fv (theVec4);
+    OpenGl_TRACE(glVertex4fv)
   }
 
   inline void glVertex4iv (const GLint*    theVec4)
   {
     ::glVertex4iv (theVec4);
+    OpenGl_TRACE(glVertex4iv)
   }
 
   inline void glVertex4sv (const GLshort*  theVec4)
   {
     ::glVertex4sv (theVec4);
+    OpenGl_TRACE(glVertex4sv)
   }
 
   inline void glNormal3b (GLbyte   nx, GLbyte   ny, GLbyte   nz)
   {
     ::glNormal3b(nx, ny, nz);
+    OpenGl_TRACE(glNormal3b)
   }
 
   inline void glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz)
   {
     ::glNormal3d(nx, ny, nz);
+    OpenGl_TRACE(glNormal3d)
   }
 
   inline void glNormal3f (GLfloat  nx, GLfloat  ny, GLfloat  nz)
   {
     ::glNormal3f(nx, ny, nz);
+    OpenGl_TRACE(glNormal3f)
   }
 
   inline void glNormal3i (GLint    nx, GLint    ny, GLint    nz)
   {
     ::glNormal3i(nx, ny, nz);
+    OpenGl_TRACE(glNormal3i)
   }
 
   inline void glNormal3s (GLshort nx, GLshort ny, GLshort nz)
   {
     ::glNormal3s(nx, ny, nz);
+    OpenGl_TRACE(glNormal3s)
   }
 
   inline void glNormal3bv (const GLbyte*   theVec)
   {
     ::glNormal3bv (theVec);
+    OpenGl_TRACE(glNormal3bv)
   }
 
   inline void glNormal3dv (const GLdouble* theVec)
   {
     ::glNormal3dv (theVec);
+    OpenGl_TRACE(glNormal3dv)
   }
 
   inline void glNormal3fv (const GLfloat*  theVec)
   {
     ::glNormal3fv (theVec);
+    OpenGl_TRACE(glNormal3fv)
   }
 
   inline void glNormal3iv (const GLint*    theVec)
   {
     ::glNormal3iv (theVec);
+    OpenGl_TRACE(glNormal3iv)
   }
 
   inline void glNormal3sv (const GLshort*  theVec)
   {
     ::glNormal3sv (theVec);
+    OpenGl_TRACE(glNormal3sv)
   }
 
   inline void glIndexd (GLdouble c)
   {
     ::glIndexd(c);
+    OpenGl_TRACE(glIndexd)
   }
 
   inline void glIndexf (GLfloat c)
   {
     ::glIndexf(c);
+    OpenGl_TRACE(glIndexf)
   }
 
   inline void glIndexi (GLint c)
   {
     ::glIndexi(c);
+    OpenGl_TRACE(glIndexi)
   }
 
   inline void glIndexs (GLshort c)
   {
     ::glIndexs(c);
+    OpenGl_TRACE(glIndexs)
   }
 
   inline void glIndexub (GLubyte c)
   {
     ::glIndexub(c);
+    OpenGl_TRACE(glIndexub)
   }
 
   inline void glIndexdv (const GLdouble* c)
   {
     ::glIndexdv(c);
+    OpenGl_TRACE(glIndexdv)
   }
 
   inline void glIndexfv (const GLfloat* c)
   {
     ::glIndexfv(c);
+    OpenGl_TRACE(glIndexfv)
   }
 
   inline void glIndexiv (const GLint* c)
   {
     ::glIndexiv(c);
+    OpenGl_TRACE(glIndexiv)
   }
 
   inline void glIndexsv (const GLshort* c)
   {
     ::glIndexsv(c);
+    OpenGl_TRACE(glIndexsv)
   }
 
   inline void glIndexubv (const GLubyte* c)
   {
     ::glIndexubv(c);
+    OpenGl_TRACE(glIndexubv)
   }
 
   inline void glColor3b (GLbyte theRed, GLbyte theGreen, GLbyte theBlue)
   {
     ::glColor3b (theRed, theGreen, theBlue);
+    OpenGl_TRACE(glColor3b)
   }
 
   inline void glColor3d (GLdouble theRed, GLdouble theGreen, GLdouble theBlue)
   {
     ::glColor3d (theRed, theGreen, theBlue);
+    OpenGl_TRACE(glColor3d)
   }
 
   inline void glColor3f (GLfloat theRed, GLfloat theGreen, GLfloat theBlue)
   {
     ::glColor3f (theRed, theGreen, theBlue);
+    OpenGl_TRACE(glColor3f)
   }
 
   inline void glColor3i (GLint theRed, GLint theGreen, GLint theBlue)
   {
     ::glColor3i (theRed, theGreen, theBlue);
+    OpenGl_TRACE(glColor3i)
   }
 
   inline void glColor3s (GLshort theRed, GLshort theGreen, GLshort theBlue)
   {
     ::glColor3s (theRed, theGreen, theBlue);
+    OpenGl_TRACE(glColor3s)
   }
 
   inline void glColor3ub (GLubyte theRed, GLubyte theGreen, GLubyte theBlue)
   {
     ::glColor3ub (theRed, theGreen, theBlue);
+    OpenGl_TRACE(glColor3ub)
   }
 
   inline void glColor3ui (GLuint theRed, GLuint theGreen, GLuint theBlue)
   {
     ::glColor3ui (theRed, theGreen, theBlue);
+    OpenGl_TRACE(glColor3ui)
   }
 
   inline void glColor3us (GLushort theRed, GLushort theGreen, GLushort theBlue)
   {
     ::glColor3us (theRed, theGreen, theBlue);
+    OpenGl_TRACE(glColor3us)
   }
 
   inline void glColor4b (GLbyte theRed, GLbyte theGreen, GLbyte theBlue, GLbyte theAlpha)
   {
     ::glColor4b (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glColor4b)
   }
 
   inline void glColor4d (GLdouble theRed, GLdouble theGreen, GLdouble theBlue, GLdouble theAlpha)
   {
     ::glColor4d (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glColor4d)
   }
 
   inline void glColor4f (GLfloat theRed, GLfloat theGreen, GLfloat theBlue, GLfloat theAlpha)
   {
     ::glColor4f (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glColor4f)
   }
 
   inline void glColor4i (GLint theRed, GLint theGreen, GLint theBlue, GLint theAlpha)
   {
     ::glColor4i (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glColor4i)
   }
 
   inline void glColor4s (GLshort theRed, GLshort theGreen, GLshort theBlue, GLshort theAlpha)
   {
     ::glColor4s (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glColor4s)
   }
 
   inline void glColor4ub (GLubyte theRed, GLubyte theGreen, GLubyte theBlue, GLubyte theAlpha)
   {
     ::glColor4ub (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glColor4ub)
   }
 
   inline void glColor4ui (GLuint theRed, GLuint theGreen, GLuint theBlue, GLuint theAlpha)
   {
     ::glColor4ui (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glColor4ui)
   }
 
   inline void glColor4us (GLushort theRed, GLushort theGreen, GLushort theBlue, GLushort theAlpha)
   {
     ::glColor4us (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glColor4us)
   }
 
   inline void glColor3bv (const GLbyte*    theVec)
   {
     ::glColor3bv (theVec);
+    OpenGl_TRACE(glColor3bv)
   }
 
   inline void glColor3dv (const GLdouble*  theVec)
   {
     ::glColor3dv (theVec);
+    OpenGl_TRACE(glColor3dv)
   }
 
   inline void glColor3fv (const GLfloat*   theVec)
   {
     ::glColor3fv (theVec);
+    OpenGl_TRACE(glColor3fv)
   }
 
   inline void glColor3iv (const GLint*     theVec)
   {
     ::glColor3iv (theVec);
+    OpenGl_TRACE(glColor3iv)
   }
 
   inline void glColor3sv (const GLshort*   theVec)
   {
     ::glColor3sv (theVec);
+    OpenGl_TRACE(glColor3sv)
   }
 
   inline void glColor3ubv (const GLubyte*  theVec)
   {
     ::glColor3ubv (theVec);
+    OpenGl_TRACE(glColor3ubv)
   }
 
   inline void glColor3uiv (const GLuint*   theVec)
   {
     ::glColor3uiv (theVec);
+    OpenGl_TRACE(glColor3uiv)
   }
 
   inline void glColor3usv (const GLushort* theVec)
   {
     ::glColor3usv (theVec);
+    OpenGl_TRACE(glColor3usv)
   }
 
   inline void glColor4bv (const GLbyte*    theVec)
   {
     ::glColor4bv (theVec);
+    OpenGl_TRACE(glColor4bv)
   }
 
   inline void glColor4dv (const GLdouble*  theVec)
   {
     ::glColor4dv (theVec);
+    OpenGl_TRACE(glColor4dv)
   }
 
   inline void glColor4fv (const GLfloat*   theVec)
   {
     ::glColor4fv (theVec);
+    OpenGl_TRACE(glColor4fv)
   }
 
   inline void glColor4iv (const GLint*     theVec)
   {
     ::glColor4iv (theVec);
+    OpenGl_TRACE(glColor4iv)
   }
 
   inline void glColor4sv (const GLshort*   theVec)
   {
     ::glColor4sv (theVec);
+    OpenGl_TRACE(glColor4sv)
   }
 
   inline void glColor4ubv (const GLubyte*  theVec)
   {
     ::glColor4ubv (theVec);
+    OpenGl_TRACE(glColor4ubv)
   }
 
   inline void glColor4uiv (const GLuint*   theVec)
   {
     ::glColor4uiv (theVec);
+    OpenGl_TRACE(glColor4uiv)
   }
 
   inline void glColor4usv (const GLushort* theVec)
   {
     ::glColor4usv (theVec);
+    OpenGl_TRACE(glColor4usv)
   }
 
   inline void glTexCoord1d (GLdouble s)
   {
     ::glTexCoord1d(s);
+    OpenGl_TRACE(glTexCoord1d);
   }
 
   inline void glTexCoord1f (GLfloat s)
   {
     ::glTexCoord1f(s);
+    OpenGl_TRACE(glTexCoord1f)
   }
 
   inline void glTexCoord1i (GLint s)
   {
     ::glTexCoord1i(s);
+    OpenGl_TRACE(glTexCoord1i)
   }
 
   inline void glTexCoord1s (GLshort s)
   {
     ::glTexCoord1s(s);
+    OpenGl_TRACE(glTexCoord1s)
   }
 
   inline void glTexCoord2d (GLdouble s, GLdouble t)
   {
     ::glTexCoord2d(s, t);
+    OpenGl_TRACE(glTexCoord2d)
   }
 
   inline void glTexCoord2f (GLfloat s, GLfloat t)
   {
     ::glTexCoord2f(s, t);
+    OpenGl_TRACE(glTexCoord2f)
   }
 
   inline void glTexCoord2i (GLint s, GLint t)
   {
     ::glTexCoord2i(s, t);
+    OpenGl_TRACE(glTexCoord2i)
   }
 
   inline void glTexCoord2s (GLshort s, GLshort t)
   {
     ::glTexCoord2s(s, t);
+    OpenGl_TRACE(glTexCoord2s)
   }
 
   inline void glTexCoord3d (GLdouble s, GLdouble t, GLdouble r)
   {
     ::glTexCoord3d(s, t, r);
+    OpenGl_TRACE(glTexCoord3d)
   }
 
   inline void glTexCoord3f (GLfloat s, GLfloat t, GLfloat r)
   {
     ::glTexCoord3f(s, t, r);
+    OpenGl_TRACE(glTexCoord3f)
   }
 
   inline void glTexCoord3i (GLint s, GLint t, GLint r)
   {
     ::glTexCoord3i(s, t, r);
+    OpenGl_TRACE(glTexCoord3i)
   }
 
   inline void glTexCoord3s (GLshort s, GLshort t, GLshort r)
   {
     ::glTexCoord3s(s, t, r);
+    OpenGl_TRACE(glTexCoord3s)
   }
 
   inline void glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q)
   {
     ::glTexCoord4d(s, t, r, q);
+    OpenGl_TRACE(glTexCoord4d)
   }
 
   inline void glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q)
   {
     ::glTexCoord4f(s, t, r, q);
+    OpenGl_TRACE(glTexCoord4f)
   }
 
   inline void glTexCoord4i (GLint s, GLint t, GLint r, GLint q)
   {
     ::glTexCoord4i(s, t, r, q);
+    OpenGl_TRACE(glTexCoord4i)
   }
 
   inline void glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q)
   {
     ::glTexCoord4s(s, t, r, q);
+    OpenGl_TRACE(glTexCoord4s)
   }
 
   inline void glTexCoord1dv (const GLdouble* theVec1)
   {
     ::glTexCoord1dv (theVec1);
+    OpenGl_TRACE(glTexCoord1dv)
   }
 
   inline void glTexCoord1fv (const GLfloat*  theVec1)
   {
     ::glTexCoord1fv (theVec1);
+    OpenGl_TRACE(glTexCoord1fv)
   }
 
   inline void glTexCoord1iv (const GLint*    theVec1)
   {
     ::glTexCoord1iv (theVec1);
+    OpenGl_TRACE(glTexCoord1iv)
   }
 
   inline void glTexCoord1sv (const GLshort*  theVec1)
   {
     ::glTexCoord1sv (theVec1);
+    OpenGl_TRACE(glTexCoord1sv)
   }
 
   inline void glTexCoord2dv (const GLdouble* theVec2)
   {
     ::glTexCoord2dv (theVec2);
+    OpenGl_TRACE(glTexCoord2dv)
   }
 
   inline void glTexCoord2fv (const GLfloat*  theVec2)
   {
     ::glTexCoord2fv (theVec2);
+    OpenGl_TRACE(glTexCoord2fv)
   }
 
   inline void glTexCoord2iv (const GLint*    theVec2)
   {
     ::glTexCoord2iv (theVec2);
+    OpenGl_TRACE(glTexCoord2iv)
   }
 
   inline void glTexCoord2sv (const GLshort*  theVec)
   {
     ::glTexCoord2sv (theVec);
+    OpenGl_TRACE(glTexCoord2sv)
   }
 
   inline void glTexCoord3dv (const GLdouble* theVec3)
   {
     ::glTexCoord3dv (theVec3);
+    OpenGl_TRACE(glTexCoord3dv)
   }
 
   inline void glTexCoord3fv (const GLfloat*  theVec3)
   {
     ::glTexCoord3fv (theVec3);
+    OpenGl_TRACE(glTexCoord3fv)
   }
 
   inline void glTexCoord3iv (const GLint*    theVec3)
   {
     ::glTexCoord3iv (theVec3);
+    OpenGl_TRACE(glTexCoord3iv)
   }
 
   inline void glTexCoord3sv (const GLshort*  theVec3)
   {
     ::glTexCoord3sv (theVec3);
+    OpenGl_TRACE(glTexCoord3sv)
   }
 
   inline void glTexCoord4dv (const GLdouble* theVec4)
   {
     ::glTexCoord4dv (theVec4);
+    OpenGl_TRACE(glTexCoord4dv)
   }
 
   inline void glTexCoord4fv (const GLfloat*  theVec4)
   {
     ::glTexCoord4fv (theVec4);
+    OpenGl_TRACE(glTexCoord4fv)
   }
 
   inline void glTexCoord4iv (const GLint*    theVec4)
   {
     ::glTexCoord4iv (theVec4);
+    OpenGl_TRACE(glTexCoord4iv)
   }
 
   inline void glTexCoord4sv (const GLshort*  theVec4)
   {
     ::glTexCoord4sv (theVec4);
+    OpenGl_TRACE(glTexCoord4sv)
   }
 
 public: //! @name Matrix operations (removed since 3.1)
@@ -599,6 +712,7 @@ public: //! @name Matrix operations (removed since 3.1)
   inline void glMatrixMode (GLenum theMode)
   {
     ::glMatrixMode (theMode);
+    OpenGl_TRACE(glMatrixMode)
   }
 
   inline void glOrtho (GLdouble theLeft,    GLdouble theRight,
@@ -606,6 +720,7 @@ public: //! @name Matrix operations (removed since 3.1)
                        GLdouble theNearVal, GLdouble theFarVal)
   {
     ::glOrtho (theLeft, theRight, theBottom, theTop, theNearVal, theFarVal);
+    OpenGl_TRACE(glOrtho)
   }
 
   inline void glFrustum (GLdouble theLeft,    GLdouble theRight,
@@ -613,41 +728,49 @@ public: //! @name Matrix operations (removed since 3.1)
                          GLdouble theNearVal, GLdouble theFarVal)
   {
     ::glFrustum (theLeft, theRight, theBottom, theTop, theNearVal, theFarVal);
+    OpenGl_TRACE(glFrustum)
   }
 
   inline void glPushMatrix()
   {
     ::glPushMatrix();
+    OpenGl_TRACE(glPushMatrix)
   }
 
   inline void glPopMatrix()
   {
     ::glPopMatrix();
+    OpenGl_TRACE(glPopMatrix)
   }
 
   inline void glLoadIdentity()
   {
     ::glLoadIdentity();
+    OpenGl_TRACE(glLoadIdentity)
   }
 
   inline void glLoadMatrixd (const GLdouble* theMatrix)
   {
     ::glLoadMatrixd (theMatrix);
+    OpenGl_TRACE(glLoadMatrixd)
   }
 
   inline void glLoadMatrixf (const GLfloat*  theMatrix)
   {
     ::glLoadMatrixf (theMatrix);
+    OpenGl_TRACE(glLoadMatrixf)
   }
 
   inline void glMultMatrixd (const GLdouble* theMatrix)
   {
     ::glMultMatrixd (theMatrix);
+    OpenGl_TRACE(glMultMatrixd)
   }
 
   inline void glMultMatrixf (const GLfloat*  theMatrix)
   {
     ::glMultMatrixf (theMatrix);
+    OpenGl_TRACE(glMultMatrixf)
   }
 
 public: //! @name Line and Polygon stripple (removed since 3.1)
@@ -657,16 +780,19 @@ public: //! @name Line and Polygon stripple (removed since 3.1)
   inline void glLineStipple (GLint theFactor, GLushort thePattern)
   {
     ::glLineStipple (theFactor, thePattern);
+    OpenGl_TRACE(glLineStipple)
   }
 
   inline void glPolygonStipple (const GLubyte* theMask)
   {
     ::glPolygonStipple (theMask);
+    OpenGl_TRACE(glPolygonStipple)
   }
 
   inline void glGetPolygonStipple (GLubyte* theMask)
   {
     ::glGetPolygonStipple (theMask);
+    OpenGl_TRACE(glGetPolygonStipple)
   }
 
 public: //! @name Attribute stacks (removed since 3.1)
@@ -674,21 +800,25 @@ public: //! @name Attribute stacks (removed since 3.1)
   inline void glPushAttrib (GLbitfield theMask)
   {
     ::glPushAttrib (theMask);
+    OpenGl_TRACE(glPushAttrib)
   }
 
   inline void glPopAttrib()
   {
     ::glPopAttrib();
+    OpenGl_TRACE(glPopAttrib)
   }
 
   inline void glPushClientAttrib (GLbitfield theMask)
   {
     ::glPushClientAttrib (theMask);
+    OpenGl_TRACE(glPushClientAttrib)
   }
 
   inline void glPopClientAttrib()
   {
     ::glPopClientAttrib();
+    OpenGl_TRACE(glPopClientAttrib)
   }
 
 public: //! @name Fixed pipeline lighting (removed since 3.1)
@@ -696,91 +826,109 @@ public: //! @name Fixed pipeline lighting (removed since 3.1)
   inline void glShadeModel (GLenum theMode)
   {
     ::glShadeModel (theMode);
+    OpenGl_TRACE(glShadeModel)
   }
 
   inline void glLightf (GLenum theLight, GLenum pname, GLfloat param)
   {
     ::glLightf (theLight, pname, param);
+    OpenGl_TRACE(glLightf)
   }
 
   inline void glLighti (GLenum theLight, GLenum pname, GLint param)
   {
     ::glLighti (theLight, pname, param);
+    OpenGl_TRACE(glLighti)
   }
 
   inline void glLightfv (GLenum theLight, GLenum pname, const GLfloat* params)
   {
     ::glLightfv (theLight, pname, params);
+    OpenGl_TRACE(glLightfv)
   }
 
   inline void glLightiv (GLenum theLight, GLenum pname, const GLint* params)
   {
     ::glLightiv (theLight, pname, params);
+    OpenGl_TRACE(glLightiv)
   }
 
   inline void glGetLightfv (GLenum theLight, GLenum pname, GLfloat *params)
   {
     ::glGetLightfv (theLight, pname, params);
+    OpenGl_TRACE(glGetLightfv)
   }
 
   inline void glGetLightiv (GLenum theLight, GLenum pname, GLint *params)
   {
     ::glGetLightiv (theLight, pname, params);
+    OpenGl_TRACE(glGetLightiv)
   }
 
   inline void glLightModelf (GLenum pname, GLfloat param)
   {
     ::glLightModelf(pname, param);
+    OpenGl_TRACE(glLightModelf)
   }
 
   inline void glLightModeli (GLenum pname, GLint param)
   {
     ::glLightModeli(pname, param);
+    OpenGl_TRACE(glLightModeli)
   }
 
   inline void glLightModelfv (GLenum pname, const GLfloat* params)
   {
     ::glLightModelfv(pname, params);
+    OpenGl_TRACE(glLightModelfv)
   }
 
   inline void glLightModeliv (GLenum pname, const GLint* params)
   {
     ::glLightModeliv(pname, params);
+    OpenGl_TRACE(glLightModeliv)
   }
 
   inline void glMaterialf (GLenum face, GLenum pname, GLfloat param)
   {
     ::glMaterialf(face, pname, param);
+    OpenGl_TRACE(glMaterialf)
   }
 
   inline void glMateriali (GLenum face, GLenum pname, GLint param)
   {
     ::glMateriali(face, pname, param);
+    OpenGl_TRACE(glMateriali)
   }
 
   inline void glMaterialfv (GLenum face, GLenum pname, const GLfloat* params)
   {
     ::glMaterialfv(face, pname, params);
+    OpenGl_TRACE(glMaterialfv)
   }
 
   inline void glMaterialiv (GLenum face, GLenum pname, const GLint* params)
   {
     ::glMaterialiv(face, pname, params);
+    OpenGl_TRACE(glMaterialiv)
   }
 
   inline void glGetMaterialfv (GLenum face, GLenum pname, GLfloat* params)
   {
     ::glGetMaterialfv(face, pname, params);
+    OpenGl_TRACE(glGetMaterialfv)
   }
 
   inline void glGetMaterialiv (GLenum face, GLenum pname, GLint* params)
   {
     ::glGetMaterialiv(face, pname, params);
+    OpenGl_TRACE(glGetMaterialiv)
   }
 
   inline void glColorMaterial (GLenum face, GLenum mode)
   {
     ::glColorMaterial(face, mode);
+    OpenGl_TRACE(glColorMaterial)
   }
 
 public: //! @name clipping plane (removed since 3.1)
@@ -788,52 +936,65 @@ public: //! @name clipping plane (removed since 3.1)
   inline void glClipPlane (GLenum thePlane, const GLdouble* theEquation)
   {
     ::glClipPlane (thePlane, theEquation);
+    OpenGl_TRACE(glClipPlane)
   }
 
   inline void glGetClipPlane (GLenum thePlane, GLdouble* theEquation)
   {
     ::glGetClipPlane (thePlane, theEquation);
+    OpenGl_TRACE(glGetClipPlane)
   }
 
 public: //! @name Display lists (removed since 3.1)
 
-  inline GLboolean glIsList (GLuint theList) {
-    return ::glIsList (theList);
+  inline GLboolean glIsList (GLuint theList)
+  {
+    const GLboolean aRes = ::glIsList (theList);
+    OpenGl_TRACE(glIsList)
+    return aRes;
   }
 
   inline void glDeleteLists (GLuint theList, GLsizei theRange)
   {
     ::glDeleteLists (theList, theRange);
+    OpenGl_TRACE(glDeleteLists)
   }
 
   inline GLuint glGenLists (GLsizei theRange)
   {
-    return ::glGenLists (theRange);
+    const GLuint aRes = ::glGenLists (theRange);
+    OpenGl_TRACE(glGenLists)
+    return aRes;
   }
 
   inline void glNewList (GLuint theList, GLenum theMode)
   {
     ::glNewList (theList, theMode);
+    OpenGl_TRACE(glNewList)
   }
 
   inline void glEndList()
   {
     ::glEndList();
+    OpenGl_TRACE(glEndList)
   }
 
   inline void glCallList (GLuint theList)
   {
     ::glCallList (theList);
+    OpenGl_TRACE(glCallList)
   }
 
   inline void glCallLists (GLsizei theNb, GLenum theType, const GLvoid* theLists)
   {
     ::glCallLists (theNb, theType, theLists);
+    OpenGl_TRACE(glCallLists)
   }
 
   inline void glListBase (GLuint theBase)
   {
     ::glListBase (theBase);
+    OpenGl_TRACE(glListBase)
   }
 
 public: //! @name Current raster position and Rectangles (removed since 3.1)
@@ -841,161 +1002,193 @@ public: //! @name Current raster position and Rectangles (removed since 3.1)
   inline void glRasterPos2d (GLdouble x, GLdouble y)
   {
     ::glRasterPos2d (x, y);
+    OpenGl_TRACE(glRasterPos2d)
   }
 
   inline void glRasterPos2f (GLfloat  x, GLfloat  y)
   {
     ::glRasterPos2f (x, y);
+    OpenGl_TRACE(glRasterPos2f)
   }
 
   inline void glRasterPos2i (GLint    x, GLint    y)
   {
     ::glRasterPos2i (x, y);
+    OpenGl_TRACE(glRasterPos2i)
   }
 
   inline void glRasterPos2s (GLshort  x, GLshort  y)
   {
     ::glRasterPos2s (x, y);
+    OpenGl_TRACE(glRasterPos2s)
   }
 
   inline void glRasterPos3d (GLdouble x, GLdouble y, GLdouble z)
   {
     ::glRasterPos3d (x, y, z);
+    OpenGl_TRACE(glRasterPos3d)
   }
 
   inline void glRasterPos3f (GLfloat  x, GLfloat  y, GLfloat  z)
   {
     ::glRasterPos3f (x, y, z);
+    OpenGl_TRACE(glRasterPos3f)
   }
 
   inline void glRasterPos3i (GLint    x, GLint    y, GLint    z)
   {
     ::glRasterPos3i (x, y, z);
+    OpenGl_TRACE(glRasterPos3i)
   }
 
   inline void glRasterPos3s (GLshort  x, GLshort  y, GLshort  z)
   {
     ::glRasterPos3s (x, y, z);
+    OpenGl_TRACE(glRasterPos3s)
   }
 
   inline void glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w)
   {
     ::glRasterPos4d (x, y, z, w);
+    OpenGl_TRACE(glRasterPos4d)
   }
 
   inline void glRasterPos4f (GLfloat  x, GLfloat  y, GLfloat  z, GLfloat  w)
   {
     ::glRasterPos4f (x, y, z, w);
+    OpenGl_TRACE(glRasterPos4f)
   }
 
   inline void glRasterPos4i (GLint    x, GLint    y, GLint    z, GLint    w)
   {
     ::glRasterPos4i (x, y, z, w);
+    OpenGl_TRACE(glRasterPos4i)
   }
 
   inline void glRasterPos4s (GLshort  x, GLshort  y, GLshort  z, GLshort  w)
   {
     ::glRasterPos4s (x, y, z, w);
+    OpenGl_TRACE(glRasterPos4s)
   }
 
   inline void glRasterPos2dv (const GLdouble* theVec)
   {
     ::glRasterPos2dv (theVec);
+    OpenGl_TRACE(glRasterPos2dv)
   }
 
   inline void glRasterPos2fv (const GLfloat*  theVec)
   {
     ::glRasterPos2fv (theVec);
+    OpenGl_TRACE(glRasterPos2fv)
   }
 
   inline void glRasterPos2iv (const GLint*    theVec)
   {
     ::glRasterPos2iv (theVec);
+    OpenGl_TRACE(glRasterPos2iv)
   }
 
   inline void glRasterPos2sv (const GLshort*  theVec)
   {
     ::glRasterPos2sv (theVec);
+    OpenGl_TRACE(glRasterPos2sv)
   }
 
   inline void glRasterPos3dv (const GLdouble* theVec)
   {
     ::glRasterPos3dv (theVec);
+    OpenGl_TRACE(glRasterPos3dv)
   }
 
   inline void glRasterPos3fv (const GLfloat*  theVec)
   {
     ::glRasterPos3fv (theVec);
+    OpenGl_TRACE(glRasterPos3fv)
   }
 
   inline void glRasterPos3iv (const GLint*    theVec)
   {
     ::glRasterPos3iv (theVec);
+    OpenGl_TRACE(glRasterPos3iv)
   }
 
   inline void glRasterPos3sv (const GLshort*  theVec)
   {
     ::glRasterPos3sv (theVec);
+    OpenGl_TRACE(glRasterPos3sv)
   }
 
   inline void glRasterPos4dv (const GLdouble* theVec)
   {
     ::glRasterPos4dv (theVec);
+    OpenGl_TRACE(glRasterPos4dv)
   }
 
   inline void glRasterPos4fv (const GLfloat*  theVec)
   {
     ::glRasterPos4fv (theVec);
+    OpenGl_TRACE(glRasterPos4fv)
   }
 
   inline void glRasterPos4iv (const GLint*    theVec)
   {
     ::glRasterPos4iv (theVec);
+    OpenGl_TRACE(glRasterPos4iv)
   }
 
   inline void glRasterPos4sv (const GLshort*  theVec)
   {
     ::glRasterPos4sv (theVec);
+    OpenGl_TRACE(glRasterPos4sv)
   }
 
   inline void glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
   {
     ::glRectd (x1, y1, x2, y2);
+    OpenGl_TRACE(glRectd)
   }
 
   inline void glRectf (GLfloat  x1, GLfloat  y1, GLfloat  x2, GLfloat  y2)
   {
     ::glRectf (x1, y1, x2, y2);
+    OpenGl_TRACE(glRectf)
   }
 
   inline void glRecti (GLint    x1, GLint    y1, GLint    x2, GLint    y2)
   {
     ::glRecti (x1, y1, x2, y2);
+    OpenGl_TRACE(glRecti)
   }
 
   inline void glRects (GLshort  x1, GLshort  y1, GLshort  x2, GLshort  y2)
   {
     ::glRects (x1, y1, x2, y2);
+    OpenGl_TRACE(glRects)
   }
 
   inline void glRectdv (const GLdouble* v1, const GLdouble* v2)
   {
     ::glRectdv (v1, v2);
+    OpenGl_TRACE(glRectdv)
   }
 
   inline void glRectfv (const GLfloat*  v1, const GLfloat*  v2)
   {
     ::glRectfv (v1, v2);
+    OpenGl_TRACE(glRectfv)
   }
 
   inline void glRectiv (const GLint*    v1, const GLint*    v2)
   {
     ::glRectiv (v1, v2);
+    OpenGl_TRACE(glRectiv)
   }
 
   inline void glRectsv (const GLshort*  v1, const GLshort*  v2)
   {
     ::glRectsv (v1, v2);
+    OpenGl_TRACE(glRectsv)
   }
 
 public: //! @name Texture mapping (removed since 3.1)
@@ -1003,46 +1196,55 @@ public: //! @name Texture mapping (removed since 3.1)
   inline void glTexGend (GLenum coord, GLenum pname, GLdouble param)
   {
     ::glTexGend (coord, pname, param);
+    OpenGl_TRACE(glTexGend)
   }
 
   inline void glTexGenf (GLenum coord, GLenum pname, GLfloat param)
   {
     ::glTexGenf (coord, pname, param);
+    OpenGl_TRACE(glTexGenf)
   }
 
   inline void glTexGeni (GLenum coord, GLenum pname, GLint param)
   {
     ::glTexGeni (coord, pname, param);
+    OpenGl_TRACE(glTexGeni)
   }
 
   inline void glTexGendv (GLenum coord, GLenum pname, const GLdouble* params)
   {
     ::glTexGendv (coord, pname, params);
+    OpenGl_TRACE(glTexGendv)
   }
 
   inline void glTexGenfv (GLenum coord, GLenum pname, const GLfloat* params)
   {
     ::glTexGenfv (coord, pname, params);
+    OpenGl_TRACE(glTexGenfv)
   }
 
   inline void glTexGeniv (GLenum coord, GLenum pname, const GLint* params)
   {
     ::glTexGeniv (coord, pname, params);
+    OpenGl_TRACE(glTexGeniv)
   }
 
   inline void glGetTexGendv (GLenum coord, GLenum pname, GLdouble* params)
   {
     ::glGetTexGendv (coord, pname, params);
+    OpenGl_TRACE(glGetTexGendv)
   }
 
   inline void glGetTexGenfv (GLenum coord, GLenum pname, GLfloat* params)
   {
     ::glGetTexGenfv (coord, pname, params);
+    OpenGl_TRACE(glGetTexGenfv)
   }
 
   inline void glGetTexGeniv (GLenum coord, GLenum pname, GLint* params)
   {
     ::glGetTexGeniv (coord, pname, params);
+    OpenGl_TRACE(glGetTexGeniv)
   }
 
 public: //! @name Resident textures and priorities (removed since 3.1)
@@ -1050,11 +1252,14 @@ public: //! @name Resident textures and priorities (removed since 3.1)
   inline void glPrioritizeTextures (GLsizei n, const GLuint* textures, const GLclampf* priorities)
   {
     ::glPrioritizeTextures (n, textures, priorities);
+    OpenGl_TRACE(glPrioritizeTextures)
   }
 
   inline GLboolean glAreTexturesResident (GLsizei n, const GLuint* textures, GLboolean* residences)
   {
-    return ::glAreTexturesResident (n, textures, residences);
+    const GLboolean aRes = ::glAreTexturesResident (n, textures, residences);
+    OpenGl_TRACE(glAreTexturesResident)
+    return aRes;
   }
 
 public: //! @name Pixel copying (removed since 3.1)
@@ -1064,6 +1269,7 @@ public: //! @name Pixel copying (removed since 3.1)
                             const GLvoid* pixels)
   {
     ::glDrawPixels (width, height, format, type, pixels);
+    OpenGl_TRACE(glDrawPixels)
   }
 
   inline void glCopyPixels (GLint x, GLint y,
@@ -1071,6 +1277,7 @@ public: //! @name Pixel copying (removed since 3.1)
                     GLenum type)
   {
     ::glCopyPixels (x, y, width, height, type);
+    OpenGl_TRACE(glCopyPixels)
   }
 
   inline void glBitmap (GLsizei width, GLsizei height,
@@ -1079,11 +1286,13 @@ public: //! @name Pixel copying (removed since 3.1)
                         const GLubyte* bitmap)
   {
     ::glBitmap (width, height, xorig, yorig, xmove, ymove, bitmap);
+    OpenGl_TRACE(glBitmap)
   }
 
   inline void glPixelZoom (GLfloat xfactor, GLfloat yfactor)
   {
     ::glPixelZoom (xfactor, yfactor);
+    OpenGl_TRACE(glPixelZoom)
   }
 
 public: //! @name Fog and all associated parameters (removed since 3.1)
@@ -1091,21 +1300,25 @@ public: //! @name Fog and all associated parameters (removed since 3.1)
   inline void glFogf (GLenum pname, GLfloat param)
   {
     ::glFogf (pname, param);
+    OpenGl_TRACE(glFogf)
   }
 
   inline void glFogi (GLenum pname, GLint param)
   {
     ::glFogi (pname, param);
+    OpenGl_TRACE(glFogi)
   }
 
   inline void glFogfv (GLenum pname, const GLfloat* params)
   {
     ::glFogfv (pname, params);
+    OpenGl_TRACE(glFogfv)
   }
 
   inline void glFogiv (GLenum pname, const GLint* params)
   {
     ::glFogiv (pname, params);
+    OpenGl_TRACE(glFogiv)
   }
 
 public: //! @name Evaluators (removed since 3.1)
@@ -1115,6 +1328,7 @@ public: //! @name Evaluators (removed since 3.1)
                        GLint order, const GLdouble* points)
   {
     ::glMap1d (target, u1, u2, stride, order, points);
+    OpenGl_TRACE(glMap1d)
   }
 
   inline void glMap1f (GLenum target, GLfloat u1, GLfloat u2,
@@ -1122,6 +1336,7 @@ public: //! @name Evaluators (removed since 3.1)
                        GLint order, const GLfloat* points)
   {
     ::glMap1f (target, u1, u2, stride, order, points);
+    OpenGl_TRACE(glMap1f)
   }
 
   inline void glMap2d (GLenum target,
@@ -1130,6 +1345,7 @@ public: //! @name Evaluators (removed since 3.1)
                        const GLdouble* points)
   {
     ::glMap2d (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
+    OpenGl_TRACE(glMap2d)
   }
 
   inline void glMap2f (GLenum target,
@@ -1138,103 +1354,123 @@ public: //! @name Evaluators (removed since 3.1)
                        const GLfloat* points)
   {
     ::glMap2f (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
+    OpenGl_TRACE(glMap2f)
   }
 
   inline void glGetMapdv (GLenum target, GLenum query, GLdouble* v)
   {
     ::glGetMapdv (target, query, v);
+    OpenGl_TRACE(glGetMapdv)
   }
 
   inline void glGetMapfv (GLenum target, GLenum query, GLfloat* v)
   {
     ::glGetMapfv (target, query, v);
+    OpenGl_TRACE(glGetMapfv)
   }
 
   inline void glGetMapiv (GLenum target, GLenum query, GLint* v)
   {
     ::glGetMapiv (target, query, v);
+    OpenGl_TRACE(glGetMapiv)
   }
 
   inline void glEvalCoord1d (GLdouble u)
   {
     ::glEvalCoord1d (u);
+    OpenGl_TRACE(glEvalCoord1d)
   }
 
   inline void glEvalCoord1f (GLfloat u)
   {
     ::glEvalCoord1f (u);
+    OpenGl_TRACE(glEvalCoord1f)
   }
 
   inline void glEvalCoord1dv (const GLdouble* u)
   {
     ::glEvalCoord1dv (u);
+    OpenGl_TRACE(glEvalCoord1dv)
   }
 
   inline void glEvalCoord1fv (const GLfloat* u)
   {
     ::glEvalCoord1fv (u);
+    OpenGl_TRACE(glEvalCoord1fv)
   }
 
   inline void glEvalCoord2d (GLdouble u, GLdouble v)
   {
     ::glEvalCoord2d (u, v);
+    OpenGl_TRACE(glEvalCoord2d)
   }
 
   inline void glEvalCoord2f (GLfloat u, GLfloat v)
   {
     ::glEvalCoord2f (u, v);
+    OpenGl_TRACE(glEvalCoord2f)
   }
 
   inline void glEvalCoord2dv (const GLdouble* u)
   {
     ::glEvalCoord2dv (u);
+    OpenGl_TRACE(glEvalCoord2dv)
   }
 
   inline void glEvalCoord2fv (const GLfloat* u)
   {
     ::glEvalCoord2fv (u);
+    OpenGl_TRACE(glEvalCoord2fv)
   }
 
   inline void glMapGrid1d (GLint un, GLdouble u1, GLdouble u2)
   {
     ::glMapGrid1d (un, u1, u2);
+    OpenGl_TRACE(glMapGrid1d)
   }
 
   inline void glMapGrid1f (GLint un, GLfloat u1, GLfloat u2)
   {
     ::glMapGrid1f (un, u1, u2);
+    OpenGl_TRACE(glMapGrid1f)
   }
 
   inline void glMapGrid2d (GLint un, GLdouble u1, GLdouble u2,
                            GLint vn, GLdouble v1, GLdouble v2)
   {
     ::glMapGrid2d (un, u1, u2, vn, v1, v2);
+    OpenGl_TRACE(glMapGrid2d)
   }
 
   inline void glMapGrid2f (GLint un, GLfloat u1, GLfloat u2,
                            GLint vn, GLfloat v1, GLfloat v2)
   {
     ::glMapGrid2f (un, u1, u2, vn, v1, v2);
+    OpenGl_TRACE(glMapGrid2f)
   }
 
   inline void glEvalPoint1 (GLint i)
   {
     ::glEvalPoint1 (i);
+    OpenGl_TRACE(glEvalPoint1)
   }
 
   inline void glEvalPoint2 (GLint i, GLint j)
   {
     ::glEvalPoint2 (i, j);
+    OpenGl_TRACE(glEvalPoint2)
   }
 
   inline void glEvalMesh1 (GLenum mode, GLint i1, GLint i2)
   {
     ::glEvalMesh1 (mode, i1, i2);
+    OpenGl_TRACE(glEvalMesh1)
   }
 
   inline void glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
   {
     ::glEvalMesh2 (mode, i1, i2, j1, j2);
+    OpenGl_TRACE(glEvalMesh2)
   }
 
 public: //! @name Selection and feedback modes (removed since 3.1)
@@ -1242,36 +1478,43 @@ public: //! @name Selection and feedback modes (removed since 3.1)
   inline void glFeedbackBuffer (GLsizei theSize, GLenum theType, GLfloat* theBuffer)
   {
     ::glFeedbackBuffer (theSize, theType, theBuffer);
+    OpenGl_TRACE(glFeedbackBuffer)
   }
 
   inline void glPassThrough (GLfloat token)
   {
     ::glPassThrough (token);
+    OpenGl_TRACE(glPassThrough)
   }
 
   inline void glSelectBuffer (GLsizei theSize, GLuint* theBuffer)
   {
     ::glSelectBuffer (theSize, theBuffer);
+    OpenGl_TRACE(glSelectBuffer)
   }
 
   inline void glInitNames()
   {
     ::glInitNames();
+    OpenGl_TRACE(glInitNames)
   }
 
   inline void glLoadName (GLuint theName)
   {
     ::glLoadName (theName);
+    OpenGl_TRACE(glLoadName)
   }
 
   inline void glPushName (GLuint theName)
   {
     ::glPushName (theName);
+    OpenGl_TRACE(glPushName)
   }
 
   inline void glPopName()
   {
     ::glPopName();
+    OpenGl_TRACE(glPopName)
   }
 
 public: //! @name Accumulation Buffer (removed since 3.1)
@@ -1279,11 +1522,13 @@ public: //! @name Accumulation Buffer (removed since 3.1)
   inline void glClearAccum (GLfloat theRed, GLfloat theGreen, GLfloat theBlue, GLfloat theAlpha)
   {
     ::glClearAccum (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glClearAccum)
   }
 
   inline void glAccum (GLenum theOp, GLfloat theValue)
   {
     ::glAccum (theOp, theValue);
+    OpenGl_TRACE(glAccum)
   }
 
 public: //! @name Edge flags and fixed-function vertex processing (removed since 3.1)
@@ -1291,61 +1536,73 @@ public: //! @name Edge flags and fixed-function vertex processing (removed since
   inline void glEdgeFlag (GLboolean theFlag)
   {
     ::glEdgeFlag (theFlag);
+    OpenGl_TRACE(glEdgeFlag)
   }
 
   inline void glEdgeFlagv (const GLboolean* theFlag)
   {
     ::glEdgeFlagv (theFlag);
+    OpenGl_TRACE(glEdgeFlagv)
   }
 
   inline void glIndexPointer (GLenum theType, GLsizei theStride, const GLvoid* thePtr)
   {
     ::glIndexPointer (theType, theStride, thePtr);
+    OpenGl_TRACE(glIndexPointer)
   }
 
   inline void glEdgeFlagPointer (GLsizei theStride, const GLvoid* thePtr)
   {
     ::glEdgeFlagPointer (theStride, thePtr);
+    OpenGl_TRACE(glEdgeFlagPointer)
   }
 
   inline void glGetPointerv (GLenum pname, GLvoid** params)
   {
     ::glGetPointerv(pname, params);
+    OpenGl_TRACE(glGetPointerv)
   }
 
   inline void glInterleavedArrays (GLenum theFormat, GLsizei theStride, const GLvoid* thePointer)
   {
     ::glInterleavedArrays (theFormat, theStride, thePointer);
+    OpenGl_TRACE(glInterleavedArrays)
   }
 
   inline void glVertexPointer (GLint theSize, GLenum theType, GLsizei theStride, const GLvoid* thePtr)
   {
     ::glVertexPointer (theSize, theType, theStride, thePtr);
+    OpenGl_TRACE(glVertexPointer)
   }
 
   inline void glNormalPointer (GLenum theType, GLsizei theStride, const GLvoid* thePtr)
   {
     ::glNormalPointer (theType, theStride, thePtr);
+    OpenGl_TRACE(glNormalPointer)
   }
 
   inline void glColorPointer (GLint theSize, GLenum theType, GLsizei theStride, const GLvoid* thePtr)
   {
     ::glColorPointer (theSize, theType, theStride, thePtr);
+    OpenGl_TRACE(glColorPointer)
   }
 
   inline void glTexCoordPointer (GLint theSize, GLenum theType, GLsizei theStride, const GLvoid* thePtr)
   {
     ::glTexCoordPointer (theSize, theType, theStride, thePtr);
+    OpenGl_TRACE(glTexCoordPointer)
   }
 
   inline void glEnableClientState (GLenum theCap)
   {
     ::glEnableClientState (theCap);
+    OpenGl_TRACE(glEnableClientState)
   }
 
   inline void glDisableClientState (GLenum theCap)
   {
     ::glDisableClientState (theCap);
+    OpenGl_TRACE(glDisableClientState)
   }
 
 #endif
index 8f84f63dea4d8e1c0c202966c8a932cec17ca040..af26e5e859b901be0fb3d666fc9ab759d1bdbd10 100644 (file)
@@ -30,56 +30,67 @@ public: //! @name Miscellaneous
   inline void glClearColor (GLclampf theRed, GLclampf theGreen, GLclampf theBlue, GLclampf theAlpha)
   {
     ::glClearColor  (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glClearColor)
   }
 
   inline void glClear (GLbitfield theMask)
   {
     ::glClear (theMask);
+    OpenGl_TRACE(glClear)
   }
 
   inline void glColorMask (GLboolean theRed, GLboolean theGreen, GLboolean theBlue, GLboolean theAlpha)
   {
     ::glColorMask (theRed, theGreen, theBlue, theAlpha);
+    OpenGl_TRACE(glColorMask)
   }
 
   inline void glBlendFunc (GLenum sfactor, GLenum dfactor)
   {
     ::glBlendFunc(sfactor, dfactor);
+    OpenGl_TRACE(glBlendFunc)
   }
 
   inline void glCullFace (GLenum theMode)
   {
     ::glCullFace (theMode);
+    OpenGl_TRACE(glCullFace)
   }
 
   inline void glFrontFace (GLenum theMode)
   {
     ::glFrontFace (theMode);
+    OpenGl_TRACE(glFrontFace)
   }
 
   inline void glLineWidth (GLfloat theWidth)
   {
     ::glLineWidth (theWidth);
+    OpenGl_TRACE(glLineWidth)
   }
 
   inline void glPolygonOffset (GLfloat theFactor, GLfloat theUnits)
   {
     ::glPolygonOffset (theFactor, theUnits);
+    OpenGl_TRACE(glPolygonOffset)
   }
 
   inline void glScissor (GLint theX, GLint theY, GLsizei theWidth, GLsizei theHeight)
   {
     ::glScissor (theX, theY, theWidth, theHeight);
+    OpenGl_TRACE(glScissor)
   }
 
   inline void glEnable (GLenum theCap)
   {
     ::glEnable (theCap);
+    OpenGl_TRACE(glEnable)
   }
 
   inline void glDisable (GLenum theCap)
   {
     ::glDisable (theCap);
+    OpenGl_TRACE(glDisable)
   }
 
   inline GLboolean glIsEnabled (GLenum theCap)
@@ -90,16 +101,19 @@ public: //! @name Miscellaneous
   inline void glGetBooleanv (GLenum theParamName, GLboolean* theValues)
   {
     ::glGetBooleanv (theParamName, theValues);
+    OpenGl_TRACE(glGetBooleanv)
   }
 
   inline void glGetFloatv (GLenum theParamName, GLfloat* theValues)
   {
     ::glGetFloatv (theParamName, theValues);
+    OpenGl_TRACE(glGetFloatv)
   }
 
   inline void glGetIntegerv (GLenum theParamName, GLint* theValues)
   {
     ::glGetIntegerv (theParamName, theValues);
+    OpenGl_TRACE(glGetIntegerv)
   }
 
   inline GLenum glGetError()
@@ -109,22 +123,27 @@ public: //! @name Miscellaneous
 
   inline const GLubyte* glGetString (GLenum theName)
   {
-    return ::glGetString (theName);
+    const GLubyte* aRes = ::glGetString (theName);
+    OpenGl_TRACE(glGetString)
+    return aRes;
   }
 
   inline void glFinish()
   {
     ::glFinish();
+    OpenGl_TRACE(glFinish)
   }
 
   inline void glFlush()
   {
     ::glFlush();
+    OpenGl_TRACE(glFlush)
   }
 
   inline void glHint (GLenum theTarget, GLenum theMode)
   {
     ::glHint (theTarget, theMode);
+    OpenGl_TRACE(glHint)
   }
 
 public: //! @name Depth Buffer
@@ -136,6 +155,7 @@ public: //! @name Depth Buffer
   #else
     ::glClearDepth (theDepth);
   #endif
+    OpenGl_TRACE(glClearDepth)
   }
 
   inline void glClearDepthf (GLfloat theDepth)
@@ -145,16 +165,19 @@ public: //! @name Depth Buffer
   #else
     ::glClearDepth ((GLclampd )theDepth);
   #endif
+    OpenGl_TRACE(glClearDepthf)
   }
 
   inline void glDepthFunc (GLenum theFunc)
   {
     ::glDepthFunc (theFunc);
+    OpenGl_TRACE(glDepthFunc)
   }
 
   inline void glDepthMask (GLboolean theFlag)
   {
     ::glDepthMask (theFlag);
+    OpenGl_TRACE(glDepthMask)
   }
 
   inline void glDepthRange (GLclampd theNearValue,
@@ -165,6 +188,7 @@ public: //! @name Depth Buffer
   #else
     ::glDepthRange (theNearValue, theFarValue);
   #endif
+    OpenGl_TRACE(glDepthRange)
   }
 
   inline void glDepthRangef (GLfloat theNearValue,
@@ -175,6 +199,7 @@ public: //! @name Depth Buffer
   #else
     ::glDepthRange ((GLclampd )theNearValue, (GLclampd )theFarValue);
   #endif
+    OpenGl_TRACE(glDepthRangef)
   }
 
 public: //! @name Transformation
@@ -182,6 +207,7 @@ public: //! @name Transformation
   inline void glViewport (GLint theX, GLint theY, GLsizei theWidth, GLsizei theHeight)
   {
     ::glViewport (theX, theY, theWidth, theHeight);
+    OpenGl_TRACE(glViewport)
   }
 
 public: //! @name Vertex Arrays
@@ -189,11 +215,13 @@ public: //! @name Vertex Arrays
   inline void glDrawArrays (GLenum theMode, GLint theFirst, GLsizei theCount)
   {
     ::glDrawArrays (theMode, theFirst, theCount);
+    OpenGl_TRACE(glDrawArrays)
   }
 
   inline void glDrawElements (GLenum theMode, GLsizei theCount, GLenum theType, const GLvoid* theIndices)
   {
     ::glDrawElements (theMode, theCount, theType, theIndices);
+    OpenGl_TRACE(glDrawElements)
   }
 
 public: //! @name Raster functions
@@ -201,6 +229,7 @@ public: //! @name Raster functions
   inline void glPixelStorei (GLenum theParamName, GLint   theParam)
   {
     ::glPixelStorei (theParamName, theParam);
+    OpenGl_TRACE(glPixelStorei)
   }
 
   inline void glReadPixels (GLint x, GLint y,
@@ -209,6 +238,7 @@ public: //! @name Raster functions
                             GLvoid* pixels)
   {
     ::glReadPixels (x, y, width, height, format, type, pixels);
+    OpenGl_TRACE(glReadPixels)
   }
 
 public: //! @name Stenciling
@@ -216,21 +246,25 @@ public: //! @name Stenciling
   inline void glStencilFunc (GLenum func, GLint ref, GLuint mask)
   {
     ::glStencilFunc (func, ref, mask);
+    OpenGl_TRACE(glStencilFunc)
   }
 
   inline void glStencilMask (GLuint mask)
   {
     ::glStencilMask (mask);
+    OpenGl_TRACE(glStencilMask)
   }
 
   inline void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass)
   {
     ::glStencilOp (fail, zfail, zpass);
+    OpenGl_TRACE(glStencilOp)
   }
 
   inline void glClearStencil (GLint s)
   {
     ::glClearStencil (s);
+    OpenGl_TRACE(glClearStencil)
   }
 
 public: //! @name Texture mapping
@@ -238,31 +272,37 @@ public: //! @name Texture mapping
   inline void glTexParameterf (GLenum target, GLenum pname, GLfloat param)
   {
     ::glTexParameterf (target, pname, param);
+    OpenGl_TRACE(glTexParameterf)
   }
 
   inline void glTexParameteri (GLenum target, GLenum pname, GLint param)
   {
     ::glTexParameteri (target, pname, param);
+    OpenGl_TRACE(glTexParameteri)
   }
 
   inline void glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params)
   {
     ::glTexParameterfv (target, pname, params);
+    OpenGl_TRACE(glTexParameterfv)
   }
 
   inline void glTexParameteriv (GLenum target, GLenum pname, const GLint* params)
   {
     ::glTexParameteriv (target, pname, params);
+    OpenGl_TRACE(glTexParameteriv)
   }
 
   inline void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params)
   {
     ::glGetTexParameterfv (target, pname, params);
+    OpenGl_TRACE(glGetTexParameterfv)
   }
 
   inline void glGetTexParameteriv (GLenum target, GLenum pname, GLint* params)
   {
     ::glGetTexParameteriv (target, pname, params);
+    OpenGl_TRACE(glGetTexParameteriv)
   }
 
   inline void glTexImage2D (GLenum target, GLint level,
@@ -272,26 +312,32 @@ public: //! @name Texture mapping
                             const GLvoid* pixels)
   {
     ::glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels);
+    OpenGl_TRACE(glTexImage2D)
   }
 
   inline void glGenTextures (GLsizei n, GLuint* textures)
   {
     ::glGenTextures(n, textures);
+    OpenGl_TRACE(glGenTextures)
   }
 
   inline void glDeleteTextures (GLsizei n, const GLuint* textures)
   {
     ::glDeleteTextures(n, textures);
+    OpenGl_TRACE(glDeleteTextures)
   }
 
   inline void glBindTexture (GLenum target, GLuint texture)
   {
     ::glBindTexture(target, texture);
+    OpenGl_TRACE(glBindTexture)
   }
 
   inline GLboolean glIsTexture (GLuint texture)
   {
-    return ::glIsTexture (texture);
+    const GLboolean aRes = ::glIsTexture (texture);
+    OpenGl_TRACE(glIsTexture)
+    return aRes;
   }
 
   inline void glTexSubImage2D (GLenum target, GLint level,
@@ -301,6 +347,7 @@ public: //! @name Texture mapping
                                const GLvoid* pixels)
   {
     ::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+    OpenGl_TRACE(glTexSubImage2D)
   }
 
   inline void glCopyTexImage2D (GLenum target, GLint level,
@@ -310,6 +357,7 @@ public: //! @name Texture mapping
                                 GLint border)
   {
     ::glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
+    OpenGl_TRACE(glCopyTexImage2D)
   }
 
   inline void glCopyTexSubImage2D (GLenum target, GLint level,
@@ -318,6 +366,7 @@ public: //! @name Texture mapping
                                    GLsizei width, GLsizei height)
   {
     ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+    OpenGl_TRACE(glCopyTexSubImage2D)
   }
 
 #if !defined(GL_ES_VERSION_2_0)
@@ -328,6 +377,7 @@ public: //! @name Texture mapping
                             const GLvoid* pixels)
   {
     ::glTexImage1D(target, level, internalFormat, width, border, format, type, pixels);
+    OpenGl_TRACE(glTexImage1D)
   }
 
   inline void glTexSubImage1D (GLenum target, GLint level,
@@ -336,6 +386,7 @@ public: //! @name Texture mapping
                                GLenum type, const GLvoid* pixels)
   {
     ::glTexSubImage1D(target, level, xoffset, width, format, type, pixels);
+    OpenGl_TRACE(glTexSubImage1D)
   }
 
   inline void glCopyTexImage1D (GLenum target, GLint level,
@@ -344,6 +395,7 @@ public: //! @name Texture mapping
                                 GLsizei width, GLint border)
   {
     ::glCopyTexImage1D(target, level, internalformat, x, y, width, border);
+    OpenGl_TRACE(glCopyTexImage1D)
   }
 
   inline void glCopyTexSubImage1D (GLenum target, GLint level,
@@ -351,6 +403,7 @@ public: //! @name Texture mapping
                                    GLsizei width)
   {
     ::glCopyTexSubImage1D(target, level, xoffset, x, y, width);
+    OpenGl_TRACE(glCopyTexSubImage1D)
   }
 
   inline void glGetTexImage (GLenum target, GLint level,
@@ -358,6 +411,7 @@ public: //! @name Texture mapping
                              GLvoid* pixels)
   {
     ::glGetTexImage (target, level, format, type, pixels);
+    OpenGl_TRACE(glGetTexImage)
   }
 #endif
 
@@ -366,11 +420,13 @@ public: //! @name Texture mapping
   inline void glAlphaFunc (GLenum theFunc, GLclampf theRef)
   {
     ::glAlphaFunc (theFunc, theRef);
+    OpenGl_TRACE(glAlphaFunc)
   }
 
   inline void glPointSize (GLfloat theSize)
   {
     ::glPointSize (theSize);
+    OpenGl_TRACE(glPointSize)
   }
 
 #endif
index 814464ec45b009a48d272a1800c86dd526442942..1d4e805b8a733cd053bc8a5910e0feef67067b27 100644 (file)
 struct OpenGl_GlFunctions
 {
 
+  //! Check glGetError(); defined for debugging purposes.
+  //! @return TRUE on error
+  Standard_EXPORT bool debugPrintError (const char* theName) const;
+
+  // This debug macros can be enabled to help debugging OpenGL implementations
+  // without solid / working debugging capabilities.
+  //#define OpenGl_TRACE(theName) {OpenGl_GlFunctions::debugPrintError(#theName);}
+  #define OpenGl_TRACE(theName)
+
 public: //! @name OpenGL ES 1.1
 
 #if defined(GL_ES_VERSION_2_0)
@@ -107,71 +116,85 @@ public: //! @name OpenGL ES 1.1
   inline void glActiveTexture (GLenum texture) const
   {
     ::glActiveTexture (texture);
+    OpenGl_TRACE(glActiveTexture)
   }
 
   inline void glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) const
   {
     ::glCompressedTexImage2D (target, level, internalformat, width, height, border, imageSize, data);
+    OpenGl_TRACE(glCompressedTexImage2D)
   }
 
   inline void glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) const
   {
     ::glCompressedTexSubImage2D (target, level, xoffset, yoffset, width, height, format, imageSize, data);
+    OpenGl_TRACE(glCompressedTexSubImage2D)
   }
 
   inline void glBindBuffer (GLenum target, GLuint buffer) const
   {
     ::glBindBuffer (target, buffer);
+    OpenGl_TRACE(glBindBuffer)
   }
 
   inline void glBufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage) const
   {
     ::glBufferData (target, size, data, usage);
+    OpenGl_TRACE(glBufferData)
   }
 
   inline void glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data) const
   {
     ::glBufferSubData (target, offset, size, data);
+    OpenGl_TRACE(glBufferSubData)
   }
 
   inline void glDeleteBuffers (GLsizei n, const GLuint *buffers) const
   {
     ::glDeleteBuffers (n, buffers);
+    OpenGl_TRACE(glDeleteBuffers)
   }
 
   inline void glDeleteTextures (GLsizei n, const GLuint *textures) const
   {
     ::glDeleteTextures (n, textures);
+    OpenGl_TRACE(glDeleteTextures)
   }
 
   inline void glDepthFunc (GLenum func) const
   {
     ::glDepthFunc (func);
+    OpenGl_TRACE(glDepthFunc)
   }
 
   inline void glDepthMask (GLboolean flag) const
   {
     ::glDepthMask (flag);
+    OpenGl_TRACE(glDepthMask)
   }
 
   inline void glDepthRangef (GLfloat n, GLfloat f) const
   {
     ::glDepthRangef (n, f);
+    OpenGl_TRACE(glDepthRangef)
   }
 
   inline void glGenBuffers (GLsizei n, GLuint *buffers) const
   {
     ::glGenBuffers (n, buffers);
+    OpenGl_TRACE(glGenBuffers)
   }
 
   inline void glGenTextures (GLsizei n, GLuint *textures) const
   {
     ::glGenTextures (n, textures);
+    OpenGl_TRACE(glGenTextures)
   }
 
   inline void glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params) const
   {
     ::glGetBufferParameteriv (target, pname, params);
+    OpenGl_TRACE(glGetBufferParameteriv)
   }
 
   inline GLboolean glIsBuffer (GLuint buffer) const
@@ -182,6 +205,7 @@ public: //! @name OpenGL ES 1.1
   inline void glSampleCoverage (GLfloat value, GLboolean invert) const
   {
     ::glSampleCoverage (value, invert);
+    OpenGl_TRACE(glSampleCoverage)
   }
 
   inline void glMultiDrawElements (GLenum theMode, const GLsizei* theCount, GLenum theType, const void* const* theIndices, GLsizei theDrawCount) const
@@ -196,6 +220,7 @@ public: //! @name OpenGL ES 1.1
     {
       ::glDrawElements (theMode, theCount[aBatchIter], theType, theIndices[aBatchIter]);
     }
+    OpenGl_TRACE(glMultiDrawElements)
   }
 
 #endif
@@ -206,56 +231,67 @@ public: //! @name OpenGL ES 2.0
   inline void glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) const
   {
     ::glBlendColor (red, green, blue, alpha);
+    OpenGl_TRACE(glBlendColor)
   }
 
   inline void glBlendEquation (GLenum mode) const
   {
     ::glBlendEquation (mode);
+    OpenGl_TRACE(glBlendEquation)
   }
 
   inline void glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) const
   {
     ::glBlendFuncSeparate (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
+    OpenGl_TRACE(glBlendFuncSeparate)
   }
 
   inline void glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha) const
   {
     ::glBlendEquationSeparate (modeRGB, modeAlpha);
+    OpenGl_TRACE(glBlendEquationSeparate)
   }
 
   inline void glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) const
   {
     ::glStencilOpSeparate (face, sfail, dpfail, dppass);
+    OpenGl_TRACE(glStencilOpSeparate)
   }
 
   inline void glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask) const
   {
     ::glStencilFuncSeparate (face, func, ref, mask);
+    OpenGl_TRACE(glStencilFuncSeparate)
   }
 
   inline void glStencilMaskSeparate (GLenum face, GLuint mask) const
   {
     ::glStencilMaskSeparate (face, mask);
+    OpenGl_TRACE(glStencilMaskSeparate)
   }
 
   inline void glAttachShader (GLuint program, GLuint shader) const
   {
     ::glAttachShader (program, shader);
+    OpenGl_TRACE(glAttachShader)
   }
 
   inline void glBindAttribLocation (GLuint program, GLuint index, const GLchar *name) const
   {
     ::glBindAttribLocation (program, index, name);
+    OpenGl_TRACE(glBindAttribLocation)
   }
 
   inline void glBindFramebuffer (GLenum target, GLuint framebuffer) const
   {
     ::glBindFramebuffer (target, framebuffer);
+    OpenGl_TRACE(glBindFramebuffer)
   }
 
   inline void glBindRenderbuffer (GLenum target, GLuint renderbuffer) const
   {
     ::glBindRenderbuffer (target, renderbuffer);
+    OpenGl_TRACE(glBindRenderbuffer)
   }
 
   inline GLenum glCheckFramebufferStatus (GLenum target) const
@@ -266,6 +302,7 @@ public: //! @name OpenGL ES 2.0
   inline void glCompileShader (GLuint shader) const
   {
     ::glCompileShader (shader);
+    OpenGl_TRACE(glCompileShader)
   }
 
   inline GLuint glCreateProgram() const
@@ -281,151 +318,183 @@ public: //! @name OpenGL ES 2.0
   inline void glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers) const
   {
     ::glDeleteFramebuffers (n, framebuffers);
+    OpenGl_TRACE(glDeleteFramebuffers)
   }
 
   inline void glDeleteProgram (GLuint program) const
   {
     ::glDeleteProgram (program);
+    OpenGl_TRACE(glDeleteProgram)
   }
 
   inline void glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers) const
   {
     ::glDeleteRenderbuffers (n, renderbuffers);
+    OpenGl_TRACE(glDeleteRenderbuffers)
   }
 
   inline void glDeleteShader (GLuint shader) const
   {
     ::glDeleteShader (shader);
+    OpenGl_TRACE(glDeleteShader)
   }
 
   inline void glDetachShader (GLuint program, GLuint shader) const
   {
     ::glDetachShader (program, shader);
+    OpenGl_TRACE(glDetachShader)
   }
 
   inline void glDisableVertexAttribArray (GLuint index) const
   {
     ::glDisableVertexAttribArray (index);
+    OpenGl_TRACE(glDisableVertexAttribArray)
   }
 
   inline void glEnableVertexAttribArray (GLuint index) const
   {
     ::glEnableVertexAttribArray (index);
+    OpenGl_TRACE(glEnableVertexAttribArray)
   }
 
   inline void glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) const
   {
     ::glFramebufferRenderbuffer (target, attachment, renderbuffertarget, renderbuffer);
+    OpenGl_TRACE(glFramebufferRenderbuffer)
   }
 
   inline void glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) const
   {
     ::glFramebufferTexture2D (target, attachment, textarget, texture, level);
+    OpenGl_TRACE(glFramebufferTexture2D)
   }
 
   inline void glGenerateMipmap (GLenum target) const
   {
     ::glGenerateMipmap (target);
+    OpenGl_TRACE(glGenerateMipmap)
   }
 
   inline void glGenFramebuffers (GLsizei n, GLuint *framebuffers) const
   {
     ::glGenFramebuffers (n, framebuffers);
+    OpenGl_TRACE(glGenFramebuffers)
   }
 
   inline void glGenRenderbuffers (GLsizei n, GLuint *renderbuffers) const
   {
     ::glGenRenderbuffers (n, renderbuffers);
+    OpenGl_TRACE(glGenRenderbuffers)
   }
 
   inline void glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint* size, GLenum *type, GLchar *name) const
   {
     ::glGetActiveAttrib (program, index, bufSize, length, size, type, name);
+    OpenGl_TRACE(glGetActiveAttrib)
   }
 
   inline void glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint* size, GLenum *type, GLchar *name) const
   {
     ::glGetActiveUniform (program, index, bufSize, length, size, type, name);
+    OpenGl_TRACE(glGetActiveUniform)
   }
 
   inline void glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders) const
   {
     ::glGetAttachedShaders (program, maxCount, count, shaders);
+    OpenGl_TRACE(glGetAttachedShaders)
   }
 
   inline GLint glGetAttribLocation (GLuint program, const GLchar *name) const
   {
-    return ::glGetAttribLocation (program, name);
+    const GLint aRes = ::glGetAttribLocation (program, name);
+    OpenGl_TRACE(glGetAttribLocation)
+    return aRes;
   }
 
   inline void glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params) const
   {
     ::glGetFramebufferAttachmentParameteriv (target, attachment, pname, params);
+    OpenGl_TRACE(glGetFramebufferAttachmentParameteriv)
   }
 
   inline void glGetProgramiv (GLuint program, GLenum pname, GLint* params) const
   {
     ::glGetProgramiv (program, pname, params);
+    OpenGl_TRACE(glGetProgramiv)
   }
 
   inline void glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) const
   {
     ::glGetProgramInfoLog (program, bufSize, length, infoLog);
+    OpenGl_TRACE(glGetProgramInfoLog)
   }
 
   inline void glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params) const
   {
     ::glGetRenderbufferParameteriv (target, pname, params);
+    OpenGl_TRACE(glGetRenderbufferParameteriv)
   }
 
   inline void glGetShaderiv (GLuint shader, GLenum pname, GLint* params) const
   {
     ::glGetShaderiv (shader, pname, params);
+    OpenGl_TRACE(glGetShaderiv)
   }
 
   inline void glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) const
   {
     ::glGetShaderInfoLog (shader, bufSize, length, infoLog);
+    OpenGl_TRACE(glGetShaderInfoLog)
   }
 
   inline void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) const
   {
     ::glGetShaderPrecisionFormat (shadertype, precisiontype, range, precision);
+    OpenGl_TRACE(glGetShaderPrecisionFormat)
   }
 
   inline void glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source) const
   {
     ::glGetShaderSource (shader, bufSize, length, source);
+    OpenGl_TRACE(glGetShaderSource)
   }
 
   inline void glGetUniformfv (GLuint program, GLint location, GLfloat* params) const
   {
     ::glGetUniformfv (program, location, params);
+    OpenGl_TRACE(glGetUniformfv)
   }
 
   inline void glGetUniformiv (GLuint program, GLint location, GLint* params) const
   {
     ::glGetUniformiv (program, location, params);
+    OpenGl_TRACE(glGetUniformiv)
   }
 
   GLint glGetUniformLocation (GLuint program, const GLchar *name) const
   {
-    return ::glGetUniformLocation (program, name);
+    const GLint aRes = ::glGetUniformLocation (program, name);
+    OpenGl_TRACE(glGetUniformLocation)
+    return aRes;
   }
 
   inline void glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params) const
   {
     ::glGetVertexAttribfv (index, pname, params);
+    OpenGl_TRACE(glGetVertexAttribfv)
   }
 
   inline void glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params) const
   {
     ::glGetVertexAttribiv (index, pname, params);
+    OpenGl_TRACE(glGetVertexAttribiv)
   }
 
   inline void glGetVertexAttribPointerv (GLuint index, GLenum pname, void* *pointer) const
   {
     ::glGetVertexAttribPointerv (index, pname, pointer);
+    OpenGl_TRACE(glGetVertexAttribPointerv)
   }
 
   inline GLboolean glIsFramebuffer (GLuint framebuffer) const
@@ -451,176 +520,211 @@ public: //! @name OpenGL ES 2.0
   inline void glLinkProgram (GLuint program) const
   {
     ::glLinkProgram (program);
+    OpenGl_TRACE(glLinkProgram)
   }
 
   inline void glReleaseShaderCompiler() const
   {
     ::glReleaseShaderCompiler();
+    OpenGl_TRACE(glReleaseShaderCompiler)
   }
 
   inline void glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height) const
   {
     ::glRenderbufferStorage (target, internalformat, width, height);
+    OpenGl_TRACE(glRenderbufferStorage)
   }
 
   inline void glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void* binary, GLsizei length) const
   {
     ::glShaderBinary (count, shaders, binaryformat, binary, length);
+    OpenGl_TRACE(glShaderBinary)
   }
 
   inline void glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length) const
   {
     ::glShaderSource (shader, count, string, length);
+    OpenGl_TRACE(glShaderSource)
   }
 
   inline void glUniform1f (GLint location, GLfloat v0) const
   {
     ::glUniform1f (location, v0);
+    OpenGl_TRACE(glUniform1f)
   }
 
   inline void glUniform1fv (GLint location, GLsizei count, const GLfloat* value) const
   {
     ::glUniform1fv (location, count, value);
+    OpenGl_TRACE(glUniform1fv)
   }
 
   inline void glUniform1i (GLint location, GLint v0) const
   {
     ::glUniform1i (location, v0);
+    OpenGl_TRACE(glUniform1i)
   }
 
   inline void glUniform1iv (GLint location, GLsizei count, const GLint* value) const
   {
     ::glUniform1iv (location, count, value);
+    OpenGl_TRACE(glUniform1iv)
   }
 
   inline void glUniform2f (GLint location, GLfloat v0, GLfloat v1) const
   {
     ::glUniform2f (location, v0, v1);
+    OpenGl_TRACE(glUniform2f)
   }
 
   inline void glUniform2fv (GLint location, GLsizei count, const GLfloat* value) const
   {
     ::glUniform2fv (location, count, value);
+    OpenGl_TRACE(glUniform2fv)
   }
 
   inline void glUniform2i (GLint location, GLint v0, GLint v1) const
   {
     ::glUniform2i (location, v0, v1);
+    OpenGl_TRACE(glUniform2i)
   }
 
   inline void glUniform2iv (GLint location, GLsizei count, const GLint* value) const
   {
     ::glUniform2iv (location, count, value);
+    OpenGl_TRACE(glUniform2iv)
   }
 
   inline void glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2) const
   {
     ::glUniform3f (location, v0, v1, v2);
+    OpenGl_TRACE(glUniform3f)
   }
 
   inline void glUniform3fv (GLint location, GLsizei count, const GLfloat* value) const
   {
     ::glUniform3fv (location, count, value);
+    OpenGl_TRACE(glUniform3fv)
   }
 
   inline void glUniform3i (GLint location, GLint v0, GLint v1, GLint v2) const
   {
     ::glUniform3i (location, v0, v1, v2);
+    OpenGl_TRACE(glUniform3i)
   }
 
   inline void glUniform3iv (GLint location, GLsizei count, const GLint* value) const
   {
     ::glUniform3iv (location, count, value);
+    OpenGl_TRACE(glUniform3iv)
   }
 
   inline void glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) const
   {
     ::glUniform4f (location, v0, v1, v2, v3);
+    OpenGl_TRACE(glUniform4f)
   }
 
   inline void glUniform4fv (GLint location, GLsizei count, const GLfloat* value) const
   {
     ::glUniform4fv (location, count, value);
+    OpenGl_TRACE(glUniform4fv)
   }
 
   inline void glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3) const
   {
     ::glUniform4i (location, v0, v1, v2, v3);
+    OpenGl_TRACE(glUniform4i)
   }
 
   inline void glUniform4iv (GLint location, GLsizei count, const GLint* value) const
   {
     ::glUniform4iv (location, count, value);
+    OpenGl_TRACE(glUniform4iv)
   }
 
   inline void glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) const
   {
     ::glUniformMatrix2fv (location, count, transpose, value);
+    OpenGl_TRACE(glUniformMatrix2fv)
   }
 
   inline void glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) const
   {
     ::glUniformMatrix3fv (location, count, transpose, value);
+    OpenGl_TRACE(glUniformMatrix3fv)
   }
 
   inline void glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) const
   {
     ::glUniformMatrix4fv (location, count, transpose, value);
+    OpenGl_TRACE(glUniformMatrix4fv)
   }
 
   inline void glUseProgram (GLuint program) const
   {
     ::glUseProgram (program);
+    OpenGl_TRACE(glUseProgram)
   }
 
   inline void glValidateProgram (GLuint program) const
   {
     ::glValidateProgram (program);
+    OpenGl_TRACE(glValidateProgram)
   }
 
   inline void glVertexAttrib1f (GLuint index, GLfloat x) const
   {
     ::glVertexAttrib1f (index, x);
+    OpenGl_TRACE(glVertexAttrib1f)
   }
 
   inline void glVertexAttrib1fv (GLuint index, const GLfloat* v) const
   {
     ::glVertexAttrib1fv (index, v);
+    OpenGl_TRACE(glVertexAttrib1fv)
   }
 
   inline void glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y) const
   {
     ::glVertexAttrib2f (index, x, y);
+    OpenGl_TRACE(glVertexAttrib2f)
   }
 
   inline void glVertexAttrib2fv (GLuint index, const GLfloat* v) const
   {
     ::glVertexAttrib2fv (index, v);
+    OpenGl_TRACE(glVertexAttrib2fv)
   }
 
   inline void glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z) const
   {
     ::glVertexAttrib3f (index, x, y, z);
+    OpenGl_TRACE(glVertexAttrib3f)
   }
 
   inline void glVertexAttrib3fv (GLuint index, const GLfloat* v) const
   {
     ::glVertexAttrib3fv (index, v);
+    OpenGl_TRACE(glVertexAttrib3fv)
   }
 
   inline void glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) const
   {
     ::glVertexAttrib4f (index, x, y, z, w);
+    OpenGl_TRACE(glVertexAttrib4f)
   }
 
   inline void glVertexAttrib4fv (GLuint index, const GLfloat* v) const
   {
     ::glVertexAttrib4fv (index, v);
+    OpenGl_TRACE(glVertexAttrib4fv)
   }
 
   inline void glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer) const
   {
     ::glVertexAttribPointer (index, size, type, normalized, stride, pointer);
+    OpenGl_TRACE(glVertexAttribPointer)
   }
 
 public: //! @name OpenGL ES 3.0
index 5b3113b255a3ef1e48bfe53d2765973ed8dfe5fd..87ec8c5795da5726b314fb4005de0b353176c8ed 100644 (file)
@@ -404,22 +404,22 @@ Standard_Boolean OpenGl_RaytraceGeometry::AcquireTextures (const Handle(OpenGl_C
 
       aTexture->Sampler()->SetImmutable();
       aHandle = theContext->arbTexBindless->glGetTextureSamplerHandleARB (aTexture->TextureId(), aTexture->Sampler()->SamplerID());
-      const GLenum anErr = glGetError();
+      const GLenum anErr = theContext->core11fwd->glGetError();
       if (anErr != GL_NO_ERROR)
       {
         theContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
-                                 TCollection_AsciiString ("Error: Failed to get 64-bit handle of OpenGL texture #") + int(anErr));
+                                 TCollection_AsciiString ("Error: Failed to get 64-bit handle of OpenGL texture ") + OpenGl_Context::FormatGlError (anErr));
         myTextureHandles.clear();
         return Standard_False;
       }
     }
 
     theContext->arbTexBindless->glMakeTextureHandleResidentARB (aHandle);
-    const GLenum anErr = glGetError();
+    const GLenum anErr = theContext->core11fwd->glGetError();
     if (anErr != GL_NO_ERROR)
     {
       theContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
-                               TCollection_AsciiString ("Error: Failed to make OpenGL texture resident #") + int(anErr));
+                               TCollection_AsciiString ("Error: Failed to make OpenGL texture resident ") + OpenGl_Context::FormatGlError (anErr));
       return Standard_False;
     }
   }
@@ -443,11 +443,11 @@ Standard_Boolean OpenGl_RaytraceGeometry::ReleaseTextures (const Handle(OpenGl_C
   for (size_t aTexIter = 0; aTexIter < myTextureHandles.size(); ++aTexIter)
   {
     theContext->arbTexBindless->glMakeTextureHandleNonResidentARB (myTextureHandles[aTexIter]);
-    const GLenum anErr = glGetError();
+    const GLenum anErr = theContext->core11fwd->glGetError();
     if (anErr != GL_NO_ERROR)
     {
       theContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
-                               TCollection_AsciiString("Error: Failed to make OpenGL texture non-resident #") + int(anErr));
+                               TCollection_AsciiString("Error: Failed to make OpenGL texture non-resident ") + OpenGl_Context::FormatGlError (anErr));
       return Standard_False;
     }
   }
@@ -513,11 +513,11 @@ Standard_Boolean OpenGl_RaytraceGeometry::UpdateTextureHandles (const Handle(Ope
 
     aTexture->Sampler()->SetImmutable();
     aHandle = theContext->arbTexBindless->glGetTextureSamplerHandleARB (aTexture->TextureId(), aTexture->Sampler()->SamplerID());
-    const GLenum anErr = glGetError();
+    const GLenum anErr = theContext->core11fwd->glGetError();
     if (anErr != GL_NO_ERROR)
     {
       theContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
-                               TCollection_AsciiString ("Error: Failed to get 64-bit handle of OpenGL texture #") + int(anErr));
+                               TCollection_AsciiString ("Error: Failed to get 64-bit handle of OpenGL texture ") + OpenGl_Context::FormatGlError(anErr));
       myTextureHandles.clear();
       return Standard_False;
     }
index 48d2739711ba476af1d05ed19533f0dcc07f21ce..050aa5edbcadae284f66ec53116bf0925af4a9e6 100644 (file)
@@ -350,13 +350,13 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
   if (aDataPtr != NULL)
   {
     const GLint anAligment = Min ((GLint )theImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes
-    glPixelStorei (GL_UNPACK_ALIGNMENT, anAligment);
+    theCtx->core11fwd->glPixelStorei (GL_UNPACK_ALIGNMENT, anAligment);
 
   #if !defined(GL_ES_VERSION_2_0)
     // notice that GL_UNPACK_ROW_LENGTH is not available on OpenGL ES 2.0 without GL_EXT_unpack_subimage extension
     const GLint anExtraBytes = GLint(theImage->RowExtraBytes());
     const GLint aPixelsWidth = GLint(theImage->SizeRowBytes() / theImage->SizePixelBytes());
-    glPixelStorei (GL_UNPACK_ROW_LENGTH, (anExtraBytes >= anAligment) ? aPixelsWidth : 0);
+    theCtx->core11fwd->glPixelStorei (GL_UNPACK_ROW_LENGTH, (anExtraBytes >= anAligment) ? aPixelsWidth : 0);
   #endif
   }
 
@@ -370,16 +370,16 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
       applyDefaultSamplerParams (theCtx);
       if (toPatchExisting)
       {
-        glTexSubImage1D (GL_TEXTURE_1D, 0, 0,
-                         theSizeXY.x(), theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
+        theCtx->core11fwd->glTexSubImage1D (GL_TEXTURE_1D, 0, 0,
+                                            theSizeXY.x(), theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
         Unbind (theCtx);
         return true;
       }
 
       // use proxy to check texture could be created or not
-      glTexImage1D (GL_PROXY_TEXTURE_1D, 0, anIntFormat,
-                    theSizeXY.x(), 0,
-                    theFormat.PixelFormat(), theFormat.DataType(), NULL);
+      theCtx->core11fwd->glTexImage1D (GL_PROXY_TEXTURE_1D, 0, anIntFormat,
+                                       theSizeXY.x(), 0,
+                                       theFormat.PixelFormat(), theFormat.DataType(), NULL);
       glGetTexLevelParameteriv (GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
       glGetTexLevelParameteriv (GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_INTERNAL_FORMAT, &mySizedFormat);
       if (aTestWidth == 0)
@@ -390,10 +390,10 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
         return false;
       }
 
-      glTexImage1D (GL_TEXTURE_1D, 0, anIntFormat,
-                    theSizeXY.x(), 0,
-                    theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
-      if (glGetError() != GL_NO_ERROR)
+      theCtx->core11fwd->glTexImage1D (GL_TEXTURE_1D, 0, anIntFormat,
+                                       theSizeXY.x(), 0,
+                                       theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
+      if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
       {
         Unbind (theCtx);
         Release (theCtx.get());
@@ -419,16 +419,16 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
       applyDefaultSamplerParams (theCtx);
       if (toPatchExisting)
       {
-        glTexSubImage2D (GL_TEXTURE_2D, 0,
-                         0, 0,
-                         theSizeXY.x(), theSizeXY.y(),
-                         theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
+        theCtx->core11fwd->glTexSubImage2D (GL_TEXTURE_2D, 0,
+                                            0, 0,
+                                            theSizeXY.x(), theSizeXY.y(),
+                                            theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
 
         if (myMaxMipLevel > 0)
         {
           // generate mipmaps
           theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D);
-          if (glGetError() != GL_NO_ERROR)
+          if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
           {
             myMaxMipLevel = 0;
           }
@@ -440,9 +440,9 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
 
     #if !defined(GL_ES_VERSION_2_0)
       // use proxy to check texture could be created or not
-      glTexImage2D (GL_PROXY_TEXTURE_2D, 0, anIntFormat,
-                    theSizeXY.x(), theSizeXY.y(), 0,
-                    theFormat.PixelFormat(), theFormat.DataType(), NULL);
+      theCtx->core11fwd->glTexImage2D (GL_PROXY_TEXTURE_2D, 0, anIntFormat,
+                                       theSizeXY.x(), theSizeXY.y(), 0,
+                                       theFormat.PixelFormat(), theFormat.DataType(), NULL);
       glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH,  &aTestWidth);
       glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &aTestHeight);
       glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &mySizedFormat);
@@ -455,17 +455,18 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
       }
     #endif
 
-      glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
-                    theSizeXY.x(), theSizeXY.y(), 0,
-                    theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
-      GLenum anErr = glGetError();
+      theCtx->core11fwd->glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
+                                       theSizeXY.x(), theSizeXY.y(), 0,
+                                       theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
+      GLenum anErr = theCtx->core11fwd->glGetError();
       if (anErr != GL_NO_ERROR)
       {
         theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
                              TCollection_AsciiString ("Error: 2D texture ") + theSizeXY.x() + "x" + theSizeXY.y()
-                                                   + " IF: " + int(anIntFormat) + " PF: " + int(theFormat.PixelFormat())
-                                                   + " DT: " + int(theFormat.DataType())
-                                                   + " can not be created with error " + int(anErr) + ".");
+                                                   + " IF: " + OpenGl_TextureFormat::FormatFormat (anIntFormat)
+                                                   + " PF: " + OpenGl_TextureFormat::FormatFormat (theFormat.PixelFormat())
+                                                   + " DT: " + OpenGl_TextureFormat::FormatDataType (theFormat.DataType())
+                                                   + " can not be created with error " + OpenGl_Context::FormatGlError (anErr) + ".");
         Unbind (theCtx);
         Release (theCtx.get());
         return false;
@@ -479,7 +480,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
         // generate mipmaps
         //glHint (GL_GENERATE_MIPMAP_HINT, GL_NICEST);
         theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D);
-        anErr = glGetError();
+        anErr = theCtx->core11fwd->glGetError();
         if (anErr != GL_NO_ERROR)
         {
           myMaxMipLevel = 0;
@@ -651,9 +652,10 @@ bool OpenGl_Texture::InitCompressed (const Handle(OpenGl_Context)& theCtx,
     {
       theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
                            TCollection_AsciiString ("Error: 2D compressed texture ") + aMipSizeXY.x() + "x" + aMipSizeXY.y()
-                           + " IF: " + int(aFormat.Internal()) + " PF: " + int(aFormat.PixelFormat())
-                           + " DT: " + int(aFormat.DataType())
-                           + " can not be created with error " + int(aTexImgErr) + ".");
+                           + " IF: " + OpenGl_TextureFormat::FormatFormat (aFormat.Internal())
+                           + " PF: " + OpenGl_TextureFormat::FormatFormat (aFormat.PixelFormat())
+                           + " DT: " + OpenGl_TextureFormat::FormatDataType (aFormat.DataType())
+                           + " can not be created with error " + OpenGl_Context::FormatGlError (aTexImgErr) + ".");
       Unbind (theCtx);
       Release (theCtx.get());
       return false;
@@ -754,9 +756,9 @@ bool OpenGl_Texture::InitRectangle (const Handle(OpenGl_Context)& theCtx,
   // setup the alignment
   OpenGl_UnpackAlignmentSentry::Reset();
 
-  glTexImage2D (GL_PROXY_TEXTURE_RECTANGLE, 0, mySizedFormat,
-                aSizeX, aSizeY, 0,
-                myTextFormat, GL_FLOAT, NULL);
+  theCtx->core11fwd->glTexImage2D (GL_PROXY_TEXTURE_RECTANGLE, 0, mySizedFormat,
+                                   aSizeX, aSizeY, 0,
+                                   myTextFormat, GL_FLOAT, NULL);
 
   GLint aTestSizeX = 0;
   GLint aTestSizeY = 0;
@@ -771,11 +773,11 @@ bool OpenGl_Texture::InitRectangle (const Handle(OpenGl_Context)& theCtx,
     return false;
   }
 
-  glTexImage2D (myTarget, 0, mySizedFormat,
-                aSizeX, aSizeY, 0,
-                myTextFormat, GL_FLOAT, NULL);
+  theCtx->core11fwd->glTexImage2D (myTarget, 0, mySizedFormat,
+                                   aSizeX, aSizeY, 0,
+                                   myTextFormat, GL_FLOAT, NULL);
 
-  if (glGetError() != GL_NO_ERROR)
+  if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
   {
     Unbind (theCtx);
     return false;
@@ -868,7 +870,7 @@ bool OpenGl_Texture::Init3D (const Handle(OpenGl_Context)& theCtx,
                                      aSizeXYZ.x(), aSizeXYZ.y(), aSizeXYZ.z(), 0,
                                      theFormat.PixelFormat(), theFormat.DataType(), thePixels);
 
-  if (glGetError() != GL_NO_ERROR)
+  if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
   {
     Unbind (theCtx);
     Release (theCtx.get());
@@ -1027,9 +1029,10 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)&    theCtx,
           {
             theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
                                  TCollection_AsciiString ("Error: cubemap compressed texture ") + aMipSizeXY.x() + "x" + aMipSizeXY.y()
-                                 + " IF: " + int(aFormat.Internal()) + " PF: " + int(aFormat.PixelFormat())
-                                 + " DT: " + int(aFormat.DataType())
-                                 + " can not be created with error " + int(aTexImgErr) + ".");
+                                 + " IF: " + OpenGl_TextureFormat::FormatFormat (aFormat.Internal())
+                                 + " PF: " + OpenGl_TextureFormat::FormatFormat (aFormat.PixelFormat())
+                                 + " DT: " + OpenGl_TextureFormat::FormatDataType (aFormat.DataType())
+                                 + " can not be created with error " + OpenGl_Context::FormatGlError (aTexImgErr) + ".");
             Unbind (theCtx);
             Release (theCtx.get());
             return false;
@@ -1049,13 +1052,13 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)&    theCtx,
       {
 #if !defined(GL_ES_VERSION_2_0)
         const GLint anAligment = Min ((GLint)anImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes
-        glPixelStorei (GL_UNPACK_ALIGNMENT, anAligment);
+        theCtx->core11fwd->glPixelStorei (GL_UNPACK_ALIGNMENT, anAligment);
 
         // notice that GL_UNPACK_ROW_LENGTH is not available on OpenGL ES 2.0 without GL_EXT_unpack_subimage extension
         const GLint anExtraBytes = GLint(anImage->RowExtraBytes());
         const GLint aPixelsWidth = GLint(anImage->SizeRowBytes() / anImage->SizePixelBytes());
         const GLint aRowLength = (anExtraBytes >= anAligment) ? aPixelsWidth : 0;
-        glPixelStorei (GL_UNPACK_ROW_LENGTH, aRowLength);
+        theCtx->core11fwd->glPixelStorei (GL_UNPACK_ROW_LENGTH, aRowLength);
 #else
         Handle(Image_PixMap) aCopyImage = new Image_PixMap();
         aCopyImage->InitTrash (theFormat, theSize, theSize);
@@ -1071,7 +1074,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)&    theCtx,
         }
         anImage = aCopyImage;
         const GLint anAligment = Min((GLint)anImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes
-        glPixelStorei (GL_UNPACK_ALIGNMENT, anAligment);
+        theCtx->core11fwd->glPixelStorei (GL_UNPACK_ALIGNMENT, anAligment);
 #endif
         aData = anImage->Data();
       }
@@ -1086,19 +1089,19 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)&    theCtx,
       theCubeMap->Next();
     }
 
-    glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
-                  anIntFormat,
-                  GLsizei(theSize), GLsizei(theSize),
-                  0, aFormat.PixelFormat(), aFormat.DataType(),
-                  aData);
+    theCtx->core11fwd->glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
+                                     anIntFormat,
+                                     GLsizei(theSize), GLsizei(theSize),
+                                     0, aFormat.PixelFormat(), aFormat.DataType(),
+                                     aData);
 
     OpenGl_UnpackAlignmentSentry::Reset();
 
-    const GLenum anErr = glGetError();
+    const GLenum anErr = theCtx->core11fwd->glGetError();
     if (anErr != GL_NO_ERROR)
     {
       theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
-                           TCollection_AsciiString ("Unable to initialize side of cubemap. Error #") + int(anErr));
+                           TCollection_AsciiString ("Unable to initialize side of cubemap. Error ") + OpenGl_Context::FormatGlError (anErr));
       Unbind (theCtx);
       Release (theCtx.get());
       return false;
@@ -1108,11 +1111,11 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)&    theCtx,
   if (theToGenMipmap && theCtx->arbFBO != NULL)
   {
     theCtx->arbFBO->glGenerateMipmap (myTarget);
-    const GLenum anErr = glGetError();
+    const GLenum anErr = theCtx->core11fwd->glGetError();
     if (anErr != GL_NO_ERROR)
     {
       theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
-                           TCollection_AsciiString ("Unable to generate mipmap of cubemap. Error #") + int(anErr));
+                           TCollection_AsciiString ("Unable to generate mipmap of cubemap. Error ") + OpenGl_Context::FormatGlError (anErr));
       Unbind (theCtx);
       Release (theCtx.get());
       return false;
index afbfb07dcf4c03c8a3d02a4dddb10c7d624d07dd..b655d41add75d8816a344ef78d3320915babe2ef 100644 (file)
 #include <Image_SupportedFormats.hxx>
 #include <OpenGl_Context.hxx>
 
+// =======================================================================
+// function : FormatFormat
+// purpose  :
+// =======================================================================
+TCollection_AsciiString OpenGl_TextureFormat::FormatFormat (GLint theInternalFormat)
+{
+  switch (theInternalFormat)
+  {
+    // RED variations (GL_RED, OpenGL 3.0+)
+    case GL_RED:      return "GL_RED";
+    case GL_R8:       return "GL_R8";
+    case 0x822A:      return "GL_R16";
+    case GL_R16F:     return "GL_R16F"; // half-float
+    case GL_R32F:     return "GL_R32F"; // float
+    case GL_R32I:     return "GL_R32I";
+    case GL_RED_INTEGER: return "GL_RED_INTEGER";
+    //
+    case GL_RG:       return "GL_RG";
+    case GL_RG8:      return "GL_RG8";
+    case 0x822C:      return "GL_RG16";
+    case GL_RG16F:    return "GL_RG16F";
+    case GL_RG32F:    return "GL_RG32F";
+    case GL_RG32I:    return "GL_RG32I";
+    case GL_RG_INTEGER: return "GL_RG_INTEGER";
+    // RGB variations
+    case GL_RGB:      return "GL_RGB";
+    case 0x804F:      return "GL_RGB4";
+    case 0x8050:      return "GL_RGB5";
+    case GL_RGB8:     return "GL_RGB8";
+    case GL_SRGB8:    return "GL_SRGB8";
+    case 0x8052:      return "GL_RGB10";
+    case 0x8053:      return "GL_RGB12";
+    case 0x8054:      return "GL_RGB16";
+    case GL_RGB16F:   return "GL_RGB16F"; // half-float
+    case GL_RGB32F:   return "GL_RGB32F"; // float
+    case GL_RGB32I:   return "GL_RGB32I";
+    // RGBA variations
+    case GL_RGBA:     return "GL_RGBA";
+    case GL_RGBA8:    return "GL_RGBA8";
+    case GL_SRGB8_ALPHA8: return "GL_SRGB8_ALPHA8";
+    case GL_RGB10_A2: return "GL_RGB10_A2";
+    case 0x805A:      return "GL_RGBA12";
+    case 0x805B:      return "GL_RGBA16";
+    case GL_RGBA16F:  return "GL_RGBA16F"; // half-float
+    case GL_RGBA32F:  return "GL_RGBA32F"; // float
+    case GL_RGBA32I:  return "GL_RGBA32I";
+    //
+    case 0x80E0:       return "GL_BGR";
+    case GL_BGRA_EXT:  return "GL_BGRA";
+    // ALPHA variations (deprecated)
+    case GL_ALPHA:     return "GL_ALPHA";
+    case 0x803C:       return "GL_ALPHA8";
+    case 0x803E:       return "GL_ALPHA16";
+    case GL_LUMINANCE: return "GL_LUMINANCE";
+    case GL_LUMINANCE_ALPHA: return "GL_LUMINANCE_ALPHA";
+    //
+    case GL_DEPTH_COMPONENT:    return "GL_DEPTH_COMPONENT";
+    case GL_DEPTH_COMPONENT16:  return "GL_DEPTH_COMPONENT16";
+    case GL_DEPTH_COMPONENT24:  return "GL_DEPTH_COMPONENT24";
+    case GL_DEPTH_COMPONENT32F: return "GL_DEPTH_COMPONENT32F";
+    case GL_DEPTH_STENCIL:      return "GL_DEPTH_STENCIL";
+    case GL_DEPTH24_STENCIL8:   return "GL_DEPTH24_STENCIL8";
+    case GL_DEPTH32F_STENCIL8:  return "GL_DEPTH32F_STENCIL8";
+    //
+    case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:        return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT";
+    case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:       return "GL_COMPRESSED_SRGB_S3TC_DXT1_EXT";
+    case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:       return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT";
+    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT";
+    case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:       return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT";
+    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT";
+    case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:       return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT";
+    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT";
+  }
+  return OpenGl_Context::FormatGlEnumHex (theInternalFormat);
+}
+
+// =======================================================================
+// function : FormatDataType
+// purpose  :
+// =======================================================================
+TCollection_AsciiString OpenGl_TextureFormat::FormatDataType (GLint theDataType)
+{
+  switch (theDataType)
+  {
+    case GL_UNSIGNED_BYTE:     return "GL_UNSIGNED_BYTE";
+    case GL_UNSIGNED_SHORT:    return "GL_UNSIGNED_SHORT";
+    case GL_INT:               return "GL_INT";
+    case GL_UNSIGNED_INT:      return "GL_UNSIGNED_INT";
+    case GL_FLOAT:             return "GL_FLOAT";
+    case GL_HALF_FLOAT:        return "GL_HALF_FLOAT";
+    case 0x8D61:               return "GL_HALF_FLOAT_OES";
+    case GL_UNSIGNED_INT_24_8: return "GL_UNSIGNED_INT_24_8";
+    case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return "GL_FLOAT_32_UNSIGNED_INT_24_8_REV";
+  }
+  return OpenGl_Context::FormatGlEnumHex (theDataType);
+}
+
 // =======================================================================
 // function : FindFormat
 // purpose  :
index bb4eb69f3e620ff5f48675e0241c21853b473495..d8bc04c65895b55577295997ff2eeaae0fca5269 100644 (file)
@@ -18,6 +18,7 @@
 #include <Image_Format.hxx>
 #include <OpenGl_GlCore13.hxx>
 #include <Standard_Handle.hxx>
+#include <TCollection_AsciiString.hxx>
 
 class OpenGl_Context;
 
@@ -56,6 +57,12 @@ public:
                                                                     Image_CompressedFormat theFormat,
                                                                     bool theIsColorMap);
 
+  //! Format pixel format enumeration.
+  Standard_EXPORT static TCollection_AsciiString FormatFormat (GLint theInternalFormat);
+
+  //! Format data type enumeration.
+  Standard_EXPORT static TCollection_AsciiString FormatDataType (GLint theDataType);
+
 public:
 
   //! Empty constructor (invalid texture format).
index 5ac016a56f72a1cff900b531106ac954263c5794..1f28b4671f1f93e5807abbf3a6773ed06ea9c856 100644 (file)
@@ -57,7 +57,7 @@ void OpenGl_TileSampler::GrabVarianceMap (const Handle(OpenGl_Context)& theConte
   if (anErr != GL_NO_ERROR)
   {
     theContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_MEDIUM,
-                             "Error! Failed to fetch visual error map from the GPU");
+                             TCollection_AsciiString ("Error! Failed to fetch visual error map from the GPU ") + OpenGl_Context::FormatGlError (anErr));
     return;
   }
 #else
index 35b3621f99b2c5184164ab48e3b1cd418a9c4f2f..56b90b1afcdd070488e6e9aaf1a2ddf783694f3e 100644 (file)
 
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_VertexBuffer,OpenGl_Resource)
 
+// =======================================================================
+// function : FormatTarget
+// purpose  :
+// =======================================================================
+TCollection_AsciiString OpenGl_VertexBuffer::FormatTarget (GLenum theTarget)
+{
+  switch (theTarget)
+  {
+    case GL_ARRAY_BUFFER:         return "GL_ARRAY_BUFFER";
+    case GL_ELEMENT_ARRAY_BUFFER: return "GL_ELEMENT_ARRAY_BUFFER";
+    case GL_TEXTURE_BUFFER:       return "GL_TEXTURE_BUFFER";
+  }
+  return OpenGl_Context::FormatGlEnumHex (theTarget);
+}
+
 // =======================================================================
 // function : OpenGl_VertexBuffer
 // purpose  :
@@ -128,9 +143,19 @@ bool OpenGl_VertexBuffer::init (const Handle(OpenGl_Context)& theGlCtx,
   myComponentsNb = theComponentsNb;
   myElemsNb      = theElemsNb;
   theGlCtx->core15fwd->glBufferData (GetTarget(), GLsizeiptr(myElemsNb) * theStride, theData, GL_STATIC_DRAW);
-  bool isDone = (glGetError() == GL_NO_ERROR); // GL_OUT_OF_MEMORY
+  const int anErr = theGlCtx->core15fwd->glGetError();
+  if (anErr != GL_NO_ERROR
+   && anErr != GL_OUT_OF_MEMORY) // pass-through out-of-memory error, but log unexpected errors
+  {
+    theGlCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
+                           TCollection_AsciiString ("Error: glBufferData (")
+                           + FormatTarget (GetTarget()) + ","
+                           + OpenGl_Context::FormatSize (GLsizeiptr(myElemsNb) * theStride) + ","
+                           + OpenGl_Context::FormatPointer (theData) + ") Id: " + (int )myBufferId
+                           + " failed with " + OpenGl_Context::FormatGlError (anErr));
+  }
   Unbind (theGlCtx);
-  return isDone;
+  return anErr == GL_NO_ERROR;
 }
 
 // =======================================================================
@@ -155,9 +180,19 @@ bool OpenGl_VertexBuffer::subData (const Handle(OpenGl_Context)& theGlCtx,
                                         GLintptr(theElemFrom)  * GLintptr  (myComponentsNb) * aDataSize, // offset in bytes
                                         GLsizeiptr(theElemsNb) * GLsizeiptr(myComponentsNb) * aDataSize, // size   in bytes
                                         theData);
-  bool isDone = (glGetError() == GL_NO_ERROR); // some dummy error
+  const int anErr = theGlCtx->core15fwd->glGetError();
+  if (anErr != GL_NO_ERROR)
+  {
+    theGlCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
+                           TCollection_AsciiString ("Error: glBufferSubData (")
+                           + FormatTarget (GetTarget()) + ","
+                           + OpenGl_Context::FormatSize (GLintptr(theElemFrom)  * GLintptr  (myComponentsNb) * aDataSize) + ","
+                           + OpenGl_Context::FormatSize (GLsizeiptr(theElemsNb) * GLsizeiptr(myComponentsNb) * aDataSize) + ","
+                           + OpenGl_Context::FormatPointer (theData) + ") Id: " + (int )myBufferId
+                           + " failed with " + OpenGl_Context::FormatGlError (anErr));
+  }
   Unbind (theGlCtx);
-  return isDone;
+  return anErr == GL_NO_ERROR;
 }
 
 // =======================================================================
index 65c13890eefb7d69e9b221c14db772bd24d84deb..ee3eec7997a183ad9df5e0a4ade4ba17f2bf0f8e 100644 (file)
@@ -32,6 +32,9 @@ public:
   //! Helpful constants
   static const GLuint NO_BUFFER = 0;
 
+  //! Format VBO target enumeration value.
+  Standard_EXPORT static TCollection_AsciiString FormatTarget (GLenum theTarget);
+
 public:
 
   //! Create uninitialized VBO.
index 4fcaa1fa3d1d83b025b1504c0f72b6d79d8a51cc..cf258d9fefaabc7783f83009b173cf8a3be2f451 100644 (file)
@@ -2580,7 +2580,7 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer*    theReadFbo,
     aCtx->arbFBOBlit->glBlitFramebuffer (0, 0, aReadSizeX, aReadSizeY,
                                          0, 0, aDrawSizeX, aDrawSizeY,
                                          aCopyMask, GL_NEAREST);
-    const int anErr = ::glGetError();
+    const int anErr = aCtx->core11fwd->glGetError();
     if (anErr != GL_NO_ERROR)
     {
       // glBlitFramebuffer() might fail in several cases:
@@ -2592,18 +2592,14 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer*    theReadFbo,
       // - Pixel formats of FBOs do not match.
       //   This also might happen with window has pixel format,
       //   e.g. Mesa fails blitting RGBA8 -> RGB8 while other drivers support this conversion.
-      TCollection_ExtendedString aMsg = TCollection_ExtendedString() + "FBO blitting has failed [Error #" + anErr + "]\n"
+      TCollection_ExtendedString aMsg = TCollection_ExtendedString() + "FBO blitting has failed [Error " + OpenGl_Context::FormatGlError (anErr) + "]\n"
                                       + "  Please check your graphics driver settings or try updating driver.";
       if (theReadFbo->NbSamples() != 0)
       {
         myToDisableMSAA = true;
         aMsg += "\n  MSAA settings should not be overridden by driver!";
       }
-      aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
-                         GL_DEBUG_TYPE_ERROR,
-                         0,
-                         GL_DEBUG_SEVERITY_HIGH,
-                         aMsg);
+      aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, aMsg);
     }
 
     if (theDrawFbo != NULL
index 13a1160dfa6bfc2f3ca150d5c64815fbc2d3b1e8..5d452394cfc8bbe27d4c9bff3e605bdfea65004b 100755 (executable)
 #if(defined(_MSC_VER) && (_MSC_VER < 1800))
   // only Visual Studio 2013 (vc12) provides <cinttypes> header
   // we do not defined all macros here - only used by OCCT framework
+  #define PRIx64 "I64x"
+  #define PRIX64 "I64X"
   #define PRId64 "I64d"
   #define PRIu64 "I64u"
   #define SCNd64 "I64d"
   #define SCNu64 "I64u"
   #ifdef _WIN64
+    #define PRIxPTR "I64x"
+    #define PRIXPTR "I64X"
     #define PRIdPTR "I64d"
     #define PRIuPTR "I64u"
     #define SCNdPTR "I64d"
     #define SCNuPTR "I64u"
   #else
+    #define PRIxPTR "Ix"
+    #define PRIXPTR "IX"
     #define PRIdPTR "d"
     #define PRIuPTR "u"
     #define SCNdPTR "d"