1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0032082: Visualization, TKOpenGl - improve formatting of error messages

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.
This commit is contained in:
kgv 2021-01-23 21:35:46 +03:00
parent 8948e18df8
commit a46ab511c5
14 changed files with 749 additions and 101 deletions

View File

@ -43,6 +43,11 @@
#include <Standard_ProgramError.hxx> #include <Standard_ProgramError.hxx>
#include <Standard_WarningDisableFunctionCast.hxx> #include <Standard_WarningDisableFunctionCast.hxx>
#if defined(_WIN32) && defined(max)
#undef max
#endif
#include <limits>
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Context,Standard_Transient) IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Context,Standard_Transient)
#if defined(HAVE_EGL) #if defined(HAVE_EGL)
@ -1004,6 +1009,62 @@ Standard_Boolean OpenGl_Context::Init (const Aspect_Drawable theWindow,
return Standard_True; 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 // function : ResetErrors
// purpose : // purpose :
@ -1024,31 +1085,42 @@ bool OpenGl_Context::ResetErrors (const bool theToPrintErrors)
for (; anErr != GL_NO_ERROR && aPrevErr != anErr; aPrevErr = anErr, anErr = ::glGetError()) 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);
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";
break;
default:
anErrId = TCollection_ExtendedString("#") + anErr;
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); PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 0, GL_DEBUG_SEVERITY_LOW, aMsg);
} }
return hasError; 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_VALUE:
{
::glLineWidth(-1.0f);
::glLineWidth( 1.0f);
break;
}
default:
case GL_INVALID_ENUM:
{
::glEnable (0xFFFF);
break;
}
}
}
return anErr != GL_NO_ERROR;
}
// ======================================================================= // =======================================================================
// function : ReadGlVersion // function : ReadGlVersion
// purpose : // purpose :

View File

@ -232,6 +232,18 @@ public:
return theThreshold; 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: public:
//! Empty constructor. You should call Init() to perform initialization with bound GL context. //! Empty constructor. You should call Init() to perform initialization with bound GL context.

File diff suppressed because it is too large Load Diff

View File

@ -30,56 +30,67 @@ public: //! @name Miscellaneous
inline void glClearColor (GLclampf theRed, GLclampf theGreen, GLclampf theBlue, GLclampf theAlpha) inline void glClearColor (GLclampf theRed, GLclampf theGreen, GLclampf theBlue, GLclampf theAlpha)
{ {
::glClearColor (theRed, theGreen, theBlue, theAlpha); ::glClearColor (theRed, theGreen, theBlue, theAlpha);
OpenGl_TRACE(glClearColor)
} }
inline void glClear (GLbitfield theMask) inline void glClear (GLbitfield theMask)
{ {
::glClear (theMask); ::glClear (theMask);
OpenGl_TRACE(glClear)
} }
inline void glColorMask (GLboolean theRed, GLboolean theGreen, GLboolean theBlue, GLboolean theAlpha) inline void glColorMask (GLboolean theRed, GLboolean theGreen, GLboolean theBlue, GLboolean theAlpha)
{ {
::glColorMask (theRed, theGreen, theBlue, theAlpha); ::glColorMask (theRed, theGreen, theBlue, theAlpha);
OpenGl_TRACE(glColorMask)
} }
inline void glBlendFunc (GLenum sfactor, GLenum dfactor) inline void glBlendFunc (GLenum sfactor, GLenum dfactor)
{ {
::glBlendFunc(sfactor, dfactor); ::glBlendFunc(sfactor, dfactor);
OpenGl_TRACE(glBlendFunc)
} }
inline void glCullFace (GLenum theMode) inline void glCullFace (GLenum theMode)
{ {
::glCullFace (theMode); ::glCullFace (theMode);
OpenGl_TRACE(glCullFace)
} }
inline void glFrontFace (GLenum theMode) inline void glFrontFace (GLenum theMode)
{ {
::glFrontFace (theMode); ::glFrontFace (theMode);
OpenGl_TRACE(glFrontFace)
} }
inline void glLineWidth (GLfloat theWidth) inline void glLineWidth (GLfloat theWidth)
{ {
::glLineWidth (theWidth); ::glLineWidth (theWidth);
OpenGl_TRACE(glLineWidth)
} }
inline void glPolygonOffset (GLfloat theFactor, GLfloat theUnits) inline void glPolygonOffset (GLfloat theFactor, GLfloat theUnits)
{ {
::glPolygonOffset (theFactor, theUnits); ::glPolygonOffset (theFactor, theUnits);
OpenGl_TRACE(glPolygonOffset)
} }
inline void glScissor (GLint theX, GLint theY, GLsizei theWidth, GLsizei theHeight) inline void glScissor (GLint theX, GLint theY, GLsizei theWidth, GLsizei theHeight)
{ {
::glScissor (theX, theY, theWidth, theHeight); ::glScissor (theX, theY, theWidth, theHeight);
OpenGl_TRACE(glScissor)
} }
inline void glEnable (GLenum theCap) inline void glEnable (GLenum theCap)
{ {
::glEnable (theCap); ::glEnable (theCap);
OpenGl_TRACE(glEnable)
} }
inline void glDisable (GLenum theCap) inline void glDisable (GLenum theCap)
{ {
::glDisable (theCap); ::glDisable (theCap);
OpenGl_TRACE(glDisable)
} }
inline GLboolean glIsEnabled (GLenum theCap) inline GLboolean glIsEnabled (GLenum theCap)
@ -90,16 +101,19 @@ public: //! @name Miscellaneous
inline void glGetBooleanv (GLenum theParamName, GLboolean* theValues) inline void glGetBooleanv (GLenum theParamName, GLboolean* theValues)
{ {
::glGetBooleanv (theParamName, theValues); ::glGetBooleanv (theParamName, theValues);
OpenGl_TRACE(glGetBooleanv)
} }
inline void glGetFloatv (GLenum theParamName, GLfloat* theValues) inline void glGetFloatv (GLenum theParamName, GLfloat* theValues)
{ {
::glGetFloatv (theParamName, theValues); ::glGetFloatv (theParamName, theValues);
OpenGl_TRACE(glGetFloatv)
} }
inline void glGetIntegerv (GLenum theParamName, GLint* theValues) inline void glGetIntegerv (GLenum theParamName, GLint* theValues)
{ {
::glGetIntegerv (theParamName, theValues); ::glGetIntegerv (theParamName, theValues);
OpenGl_TRACE(glGetIntegerv)
} }
inline GLenum glGetError() inline GLenum glGetError()
@ -109,22 +123,27 @@ public: //! @name Miscellaneous
inline const GLubyte* glGetString (GLenum theName) inline const GLubyte* glGetString (GLenum theName)
{ {
return ::glGetString (theName); const GLubyte* aRes = ::glGetString (theName);
OpenGl_TRACE(glGetString)
return aRes;
} }
inline void glFinish() inline void glFinish()
{ {
::glFinish(); ::glFinish();
OpenGl_TRACE(glFinish)
} }
inline void glFlush() inline void glFlush()
{ {
::glFlush(); ::glFlush();
OpenGl_TRACE(glFlush)
} }
inline void glHint (GLenum theTarget, GLenum theMode) inline void glHint (GLenum theTarget, GLenum theMode)
{ {
::glHint (theTarget, theMode); ::glHint (theTarget, theMode);
OpenGl_TRACE(glHint)
} }
public: //! @name Depth Buffer public: //! @name Depth Buffer
@ -136,6 +155,7 @@ public: //! @name Depth Buffer
#else #else
::glClearDepth (theDepth); ::glClearDepth (theDepth);
#endif #endif
OpenGl_TRACE(glClearDepth)
} }
inline void glClearDepthf (GLfloat theDepth) inline void glClearDepthf (GLfloat theDepth)
@ -145,16 +165,19 @@ public: //! @name Depth Buffer
#else #else
::glClearDepth ((GLclampd )theDepth); ::glClearDepth ((GLclampd )theDepth);
#endif #endif
OpenGl_TRACE(glClearDepthf)
} }
inline void glDepthFunc (GLenum theFunc) inline void glDepthFunc (GLenum theFunc)
{ {
::glDepthFunc (theFunc); ::glDepthFunc (theFunc);
OpenGl_TRACE(glDepthFunc)
} }
inline void glDepthMask (GLboolean theFlag) inline void glDepthMask (GLboolean theFlag)
{ {
::glDepthMask (theFlag); ::glDepthMask (theFlag);
OpenGl_TRACE(glDepthMask)
} }
inline void glDepthRange (GLclampd theNearValue, inline void glDepthRange (GLclampd theNearValue,
@ -165,6 +188,7 @@ public: //! @name Depth Buffer
#else #else
::glDepthRange (theNearValue, theFarValue); ::glDepthRange (theNearValue, theFarValue);
#endif #endif
OpenGl_TRACE(glDepthRange)
} }
inline void glDepthRangef (GLfloat theNearValue, inline void glDepthRangef (GLfloat theNearValue,
@ -175,6 +199,7 @@ public: //! @name Depth Buffer
#else #else
::glDepthRange ((GLclampd )theNearValue, (GLclampd )theFarValue); ::glDepthRange ((GLclampd )theNearValue, (GLclampd )theFarValue);
#endif #endif
OpenGl_TRACE(glDepthRangef)
} }
public: //! @name Transformation public: //! @name Transformation
@ -182,6 +207,7 @@ public: //! @name Transformation
inline void glViewport (GLint theX, GLint theY, GLsizei theWidth, GLsizei theHeight) inline void glViewport (GLint theX, GLint theY, GLsizei theWidth, GLsizei theHeight)
{ {
::glViewport (theX, theY, theWidth, theHeight); ::glViewport (theX, theY, theWidth, theHeight);
OpenGl_TRACE(glViewport)
} }
public: //! @name Vertex Arrays public: //! @name Vertex Arrays
@ -189,11 +215,13 @@ public: //! @name Vertex Arrays
inline void glDrawArrays (GLenum theMode, GLint theFirst, GLsizei theCount) inline void glDrawArrays (GLenum theMode, GLint theFirst, GLsizei theCount)
{ {
::glDrawArrays (theMode, theFirst, theCount); ::glDrawArrays (theMode, theFirst, theCount);
OpenGl_TRACE(glDrawArrays)
} }
inline void glDrawElements (GLenum theMode, GLsizei theCount, GLenum theType, const GLvoid* theIndices) inline void glDrawElements (GLenum theMode, GLsizei theCount, GLenum theType, const GLvoid* theIndices)
{ {
::glDrawElements (theMode, theCount, theType, theIndices); ::glDrawElements (theMode, theCount, theType, theIndices);
OpenGl_TRACE(glDrawElements)
} }
public: //! @name Raster functions public: //! @name Raster functions
@ -201,6 +229,7 @@ public: //! @name Raster functions
inline void glPixelStorei (GLenum theParamName, GLint theParam) inline void glPixelStorei (GLenum theParamName, GLint theParam)
{ {
::glPixelStorei (theParamName, theParam); ::glPixelStorei (theParamName, theParam);
OpenGl_TRACE(glPixelStorei)
} }
inline void glReadPixels (GLint x, GLint y, inline void glReadPixels (GLint x, GLint y,
@ -209,6 +238,7 @@ public: //! @name Raster functions
GLvoid* pixels) GLvoid* pixels)
{ {
::glReadPixels (x, y, width, height, format, type, pixels); ::glReadPixels (x, y, width, height, format, type, pixels);
OpenGl_TRACE(glReadPixels)
} }
public: //! @name Stenciling public: //! @name Stenciling
@ -216,21 +246,25 @@ public: //! @name Stenciling
inline void glStencilFunc (GLenum func, GLint ref, GLuint mask) inline void glStencilFunc (GLenum func, GLint ref, GLuint mask)
{ {
::glStencilFunc (func, ref, mask); ::glStencilFunc (func, ref, mask);
OpenGl_TRACE(glStencilFunc)
} }
inline void glStencilMask (GLuint mask) inline void glStencilMask (GLuint mask)
{ {
::glStencilMask (mask); ::glStencilMask (mask);
OpenGl_TRACE(glStencilMask)
} }
inline void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass) inline void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass)
{ {
::glStencilOp (fail, zfail, zpass); ::glStencilOp (fail, zfail, zpass);
OpenGl_TRACE(glStencilOp)
} }
inline void glClearStencil (GLint s) inline void glClearStencil (GLint s)
{ {
::glClearStencil (s); ::glClearStencil (s);
OpenGl_TRACE(glClearStencil)
} }
public: //! @name Texture mapping public: //! @name Texture mapping
@ -238,31 +272,37 @@ public: //! @name Texture mapping
inline void glTexParameterf (GLenum target, GLenum pname, GLfloat param) inline void glTexParameterf (GLenum target, GLenum pname, GLfloat param)
{ {
::glTexParameterf (target, pname, param); ::glTexParameterf (target, pname, param);
OpenGl_TRACE(glTexParameterf)
} }
inline void glTexParameteri (GLenum target, GLenum pname, GLint param) inline void glTexParameteri (GLenum target, GLenum pname, GLint param)
{ {
::glTexParameteri (target, pname, param); ::glTexParameteri (target, pname, param);
OpenGl_TRACE(glTexParameteri)
} }
inline void glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params) inline void glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params)
{ {
::glTexParameterfv (target, pname, params); ::glTexParameterfv (target, pname, params);
OpenGl_TRACE(glTexParameterfv)
} }
inline void glTexParameteriv (GLenum target, GLenum pname, const GLint* params) inline void glTexParameteriv (GLenum target, GLenum pname, const GLint* params)
{ {
::glTexParameteriv (target, pname, params); ::glTexParameteriv (target, pname, params);
OpenGl_TRACE(glTexParameteriv)
} }
inline void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params) inline void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params)
{ {
::glGetTexParameterfv (target, pname, params); ::glGetTexParameterfv (target, pname, params);
OpenGl_TRACE(glGetTexParameterfv)
} }
inline void glGetTexParameteriv (GLenum target, GLenum pname, GLint* params) inline void glGetTexParameteriv (GLenum target, GLenum pname, GLint* params)
{ {
::glGetTexParameteriv (target, pname, params); ::glGetTexParameteriv (target, pname, params);
OpenGl_TRACE(glGetTexParameteriv)
} }
inline void glTexImage2D (GLenum target, GLint level, inline void glTexImage2D (GLenum target, GLint level,
@ -272,26 +312,32 @@ public: //! @name Texture mapping
const GLvoid* pixels) const GLvoid* pixels)
{ {
::glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels); ::glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels);
OpenGl_TRACE(glTexImage2D)
} }
inline void glGenTextures (GLsizei n, GLuint* textures) inline void glGenTextures (GLsizei n, GLuint* textures)
{ {
::glGenTextures(n, textures); ::glGenTextures(n, textures);
OpenGl_TRACE(glGenTextures)
} }
inline void glDeleteTextures (GLsizei n, const GLuint* textures) inline void glDeleteTextures (GLsizei n, const GLuint* textures)
{ {
::glDeleteTextures(n, textures); ::glDeleteTextures(n, textures);
OpenGl_TRACE(glDeleteTextures)
} }
inline void glBindTexture (GLenum target, GLuint texture) inline void glBindTexture (GLenum target, GLuint texture)
{ {
::glBindTexture(target, texture); ::glBindTexture(target, texture);
OpenGl_TRACE(glBindTexture)
} }
inline GLboolean glIsTexture (GLuint texture) 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, inline void glTexSubImage2D (GLenum target, GLint level,
@ -301,6 +347,7 @@ public: //! @name Texture mapping
const GLvoid* pixels) const GLvoid* pixels)
{ {
::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); ::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
OpenGl_TRACE(glTexSubImage2D)
} }
inline void glCopyTexImage2D (GLenum target, GLint level, inline void glCopyTexImage2D (GLenum target, GLint level,
@ -310,6 +357,7 @@ public: //! @name Texture mapping
GLint border) GLint border)
{ {
::glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); ::glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
OpenGl_TRACE(glCopyTexImage2D)
} }
inline void glCopyTexSubImage2D (GLenum target, GLint level, inline void glCopyTexSubImage2D (GLenum target, GLint level,
@ -318,6 +366,7 @@ public: //! @name Texture mapping
GLsizei width, GLsizei height) GLsizei width, GLsizei height)
{ {
::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
OpenGl_TRACE(glCopyTexSubImage2D)
} }
#if !defined(GL_ES_VERSION_2_0) #if !defined(GL_ES_VERSION_2_0)
@ -328,6 +377,7 @@ public: //! @name Texture mapping
const GLvoid* pixels) const GLvoid* pixels)
{ {
::glTexImage1D(target, level, internalFormat, width, border, format, type, pixels); ::glTexImage1D(target, level, internalFormat, width, border, format, type, pixels);
OpenGl_TRACE(glTexImage1D)
} }
inline void glTexSubImage1D (GLenum target, GLint level, inline void glTexSubImage1D (GLenum target, GLint level,
@ -336,6 +386,7 @@ public: //! @name Texture mapping
GLenum type, const GLvoid* pixels) GLenum type, const GLvoid* pixels)
{ {
::glTexSubImage1D(target, level, xoffset, width, format, type, pixels); ::glTexSubImage1D(target, level, xoffset, width, format, type, pixels);
OpenGl_TRACE(glTexSubImage1D)
} }
inline void glCopyTexImage1D (GLenum target, GLint level, inline void glCopyTexImage1D (GLenum target, GLint level,
@ -344,6 +395,7 @@ public: //! @name Texture mapping
GLsizei width, GLint border) GLsizei width, GLint border)
{ {
::glCopyTexImage1D(target, level, internalformat, x, y, width, border); ::glCopyTexImage1D(target, level, internalformat, x, y, width, border);
OpenGl_TRACE(glCopyTexImage1D)
} }
inline void glCopyTexSubImage1D (GLenum target, GLint level, inline void glCopyTexSubImage1D (GLenum target, GLint level,
@ -351,6 +403,7 @@ public: //! @name Texture mapping
GLsizei width) GLsizei width)
{ {
::glCopyTexSubImage1D(target, level, xoffset, x, y, width); ::glCopyTexSubImage1D(target, level, xoffset, x, y, width);
OpenGl_TRACE(glCopyTexSubImage1D)
} }
inline void glGetTexImage (GLenum target, GLint level, inline void glGetTexImage (GLenum target, GLint level,
@ -358,6 +411,7 @@ public: //! @name Texture mapping
GLvoid* pixels) GLvoid* pixels)
{ {
::glGetTexImage (target, level, format, type, pixels); ::glGetTexImage (target, level, format, type, pixels);
OpenGl_TRACE(glGetTexImage)
} }
#endif #endif
@ -366,11 +420,13 @@ public: //! @name Texture mapping
inline void glAlphaFunc (GLenum theFunc, GLclampf theRef) inline void glAlphaFunc (GLenum theFunc, GLclampf theRef)
{ {
::glAlphaFunc (theFunc, theRef); ::glAlphaFunc (theFunc, theRef);
OpenGl_TRACE(glAlphaFunc)
} }
inline void glPointSize (GLfloat theSize) inline void glPointSize (GLfloat theSize)
{ {
::glPointSize (theSize); ::glPointSize (theSize);
OpenGl_TRACE(glPointSize)
} }
#endif #endif

View File

@ -100,6 +100,15 @@
struct OpenGl_GlFunctions 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 public: //! @name OpenGL ES 1.1
#if defined(GL_ES_VERSION_2_0) #if defined(GL_ES_VERSION_2_0)
@ -107,71 +116,85 @@ public: //! @name OpenGL ES 1.1
inline void glActiveTexture (GLenum texture) const inline void glActiveTexture (GLenum texture) const
{ {
::glActiveTexture (texture); ::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 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); ::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 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); ::glCompressedTexSubImage2D (target, level, xoffset, yoffset, width, height, format, imageSize, data);
OpenGl_TRACE(glCompressedTexSubImage2D)
} }
inline void glBindBuffer (GLenum target, GLuint buffer) const inline void glBindBuffer (GLenum target, GLuint buffer) const
{ {
::glBindBuffer (target, buffer); ::glBindBuffer (target, buffer);
OpenGl_TRACE(glBindBuffer)
} }
inline void glBufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage) const inline void glBufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage) const
{ {
::glBufferData (target, size, data, usage); ::glBufferData (target, size, data, usage);
OpenGl_TRACE(glBufferData)
} }
inline void glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data) const inline void glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data) const
{ {
::glBufferSubData (target, offset, size, data); ::glBufferSubData (target, offset, size, data);
OpenGl_TRACE(glBufferSubData)
} }
inline void glDeleteBuffers (GLsizei n, const GLuint *buffers) const inline void glDeleteBuffers (GLsizei n, const GLuint *buffers) const
{ {
::glDeleteBuffers (n, buffers); ::glDeleteBuffers (n, buffers);
OpenGl_TRACE(glDeleteBuffers)
} }
inline void glDeleteTextures (GLsizei n, const GLuint *textures) const inline void glDeleteTextures (GLsizei n, const GLuint *textures) const
{ {
::glDeleteTextures (n, textures); ::glDeleteTextures (n, textures);
OpenGl_TRACE(glDeleteTextures)
} }
inline void glDepthFunc (GLenum func) const inline void glDepthFunc (GLenum func) const
{ {
::glDepthFunc (func); ::glDepthFunc (func);
OpenGl_TRACE(glDepthFunc)
} }
inline void glDepthMask (GLboolean flag) const inline void glDepthMask (GLboolean flag) const
{ {
::glDepthMask (flag); ::glDepthMask (flag);
OpenGl_TRACE(glDepthMask)
} }
inline void glDepthRangef (GLfloat n, GLfloat f) const inline void glDepthRangef (GLfloat n, GLfloat f) const
{ {
::glDepthRangef (n, f); ::glDepthRangef (n, f);
OpenGl_TRACE(glDepthRangef)
} }
inline void glGenBuffers (GLsizei n, GLuint *buffers) const inline void glGenBuffers (GLsizei n, GLuint *buffers) const
{ {
::glGenBuffers (n, buffers); ::glGenBuffers (n, buffers);
OpenGl_TRACE(glGenBuffers)
} }
inline void glGenTextures (GLsizei n, GLuint *textures) const inline void glGenTextures (GLsizei n, GLuint *textures) const
{ {
::glGenTextures (n, textures); ::glGenTextures (n, textures);
OpenGl_TRACE(glGenTextures)
} }
inline void glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params) const inline void glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params) const
{ {
::glGetBufferParameteriv (target, pname, params); ::glGetBufferParameteriv (target, pname, params);
OpenGl_TRACE(glGetBufferParameteriv)
} }
inline GLboolean glIsBuffer (GLuint buffer) const inline GLboolean glIsBuffer (GLuint buffer) const
@ -182,6 +205,7 @@ public: //! @name OpenGL ES 1.1
inline void glSampleCoverage (GLfloat value, GLboolean invert) const inline void glSampleCoverage (GLfloat value, GLboolean invert) const
{ {
::glSampleCoverage (value, invert); ::glSampleCoverage (value, invert);
OpenGl_TRACE(glSampleCoverage)
} }
inline void glMultiDrawElements (GLenum theMode, const GLsizei* theCount, GLenum theType, const void* const* theIndices, GLsizei theDrawCount) const 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]); ::glDrawElements (theMode, theCount[aBatchIter], theType, theIndices[aBatchIter]);
} }
OpenGl_TRACE(glMultiDrawElements)
} }
#endif #endif
@ -206,56 +231,67 @@ public: //! @name OpenGL ES 2.0
inline void glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) const inline void glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) const
{ {
::glBlendColor (red, green, blue, alpha); ::glBlendColor (red, green, blue, alpha);
OpenGl_TRACE(glBlendColor)
} }
inline void glBlendEquation (GLenum mode) const inline void glBlendEquation (GLenum mode) const
{ {
::glBlendEquation (mode); ::glBlendEquation (mode);
OpenGl_TRACE(glBlendEquation)
} }
inline void glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) const inline void glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) const
{ {
::glBlendFuncSeparate (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); ::glBlendFuncSeparate (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
OpenGl_TRACE(glBlendFuncSeparate)
} }
inline void glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha) const inline void glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha) const
{ {
::glBlendEquationSeparate (modeRGB, modeAlpha); ::glBlendEquationSeparate (modeRGB, modeAlpha);
OpenGl_TRACE(glBlendEquationSeparate)
} }
inline void glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) const inline void glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) const
{ {
::glStencilOpSeparate (face, sfail, dpfail, dppass); ::glStencilOpSeparate (face, sfail, dpfail, dppass);
OpenGl_TRACE(glStencilOpSeparate)
} }
inline void glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask) const inline void glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask) const
{ {
::glStencilFuncSeparate (face, func, ref, mask); ::glStencilFuncSeparate (face, func, ref, mask);
OpenGl_TRACE(glStencilFuncSeparate)
} }
inline void glStencilMaskSeparate (GLenum face, GLuint mask) const inline void glStencilMaskSeparate (GLenum face, GLuint mask) const
{ {
::glStencilMaskSeparate (face, mask); ::glStencilMaskSeparate (face, mask);
OpenGl_TRACE(glStencilMaskSeparate)
} }
inline void glAttachShader (GLuint program, GLuint shader) const inline void glAttachShader (GLuint program, GLuint shader) const
{ {
::glAttachShader (program, shader); ::glAttachShader (program, shader);
OpenGl_TRACE(glAttachShader)
} }
inline void glBindAttribLocation (GLuint program, GLuint index, const GLchar *name) const inline void glBindAttribLocation (GLuint program, GLuint index, const GLchar *name) const
{ {
::glBindAttribLocation (program, index, name); ::glBindAttribLocation (program, index, name);
OpenGl_TRACE(glBindAttribLocation)
} }
inline void glBindFramebuffer (GLenum target, GLuint framebuffer) const inline void glBindFramebuffer (GLenum target, GLuint framebuffer) const
{ {
::glBindFramebuffer (target, framebuffer); ::glBindFramebuffer (target, framebuffer);
OpenGl_TRACE(glBindFramebuffer)
} }
inline void glBindRenderbuffer (GLenum target, GLuint renderbuffer) const inline void glBindRenderbuffer (GLenum target, GLuint renderbuffer) const
{ {
::glBindRenderbuffer (target, renderbuffer); ::glBindRenderbuffer (target, renderbuffer);
OpenGl_TRACE(glBindRenderbuffer)
} }
inline GLenum glCheckFramebufferStatus (GLenum target) const inline GLenum glCheckFramebufferStatus (GLenum target) const
@ -266,6 +302,7 @@ public: //! @name OpenGL ES 2.0
inline void glCompileShader (GLuint shader) const inline void glCompileShader (GLuint shader) const
{ {
::glCompileShader (shader); ::glCompileShader (shader);
OpenGl_TRACE(glCompileShader)
} }
inline GLuint glCreateProgram() const inline GLuint glCreateProgram() const
@ -281,151 +318,183 @@ public: //! @name OpenGL ES 2.0
inline void glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers) const inline void glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers) const
{ {
::glDeleteFramebuffers (n, framebuffers); ::glDeleteFramebuffers (n, framebuffers);
OpenGl_TRACE(glDeleteFramebuffers)
} }
inline void glDeleteProgram (GLuint program) const inline void glDeleteProgram (GLuint program) const
{ {
::glDeleteProgram (program); ::glDeleteProgram (program);
OpenGl_TRACE(glDeleteProgram)
} }
inline void glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers) const inline void glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers) const
{ {
::glDeleteRenderbuffers (n, renderbuffers); ::glDeleteRenderbuffers (n, renderbuffers);
OpenGl_TRACE(glDeleteRenderbuffers)
} }
inline void glDeleteShader (GLuint shader) const inline void glDeleteShader (GLuint shader) const
{ {
::glDeleteShader (shader); ::glDeleteShader (shader);
OpenGl_TRACE(glDeleteShader)
} }
inline void glDetachShader (GLuint program, GLuint shader) const inline void glDetachShader (GLuint program, GLuint shader) const
{ {
::glDetachShader (program, shader); ::glDetachShader (program, shader);
OpenGl_TRACE(glDetachShader)
} }
inline void glDisableVertexAttribArray (GLuint index) const inline void glDisableVertexAttribArray (GLuint index) const
{ {
::glDisableVertexAttribArray (index); ::glDisableVertexAttribArray (index);
OpenGl_TRACE(glDisableVertexAttribArray)
} }
inline void glEnableVertexAttribArray (GLuint index) const inline void glEnableVertexAttribArray (GLuint index) const
{ {
::glEnableVertexAttribArray (index); ::glEnableVertexAttribArray (index);
OpenGl_TRACE(glEnableVertexAttribArray)
} }
inline void glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) const inline void glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) const
{ {
::glFramebufferRenderbuffer (target, attachment, renderbuffertarget, renderbuffer); ::glFramebufferRenderbuffer (target, attachment, renderbuffertarget, renderbuffer);
OpenGl_TRACE(glFramebufferRenderbuffer)
} }
inline void glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) const inline void glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) const
{ {
::glFramebufferTexture2D (target, attachment, textarget, texture, level); ::glFramebufferTexture2D (target, attachment, textarget, texture, level);
OpenGl_TRACE(glFramebufferTexture2D)
} }
inline void glGenerateMipmap (GLenum target) const inline void glGenerateMipmap (GLenum target) const
{ {
::glGenerateMipmap (target); ::glGenerateMipmap (target);
OpenGl_TRACE(glGenerateMipmap)
} }
inline void glGenFramebuffers (GLsizei n, GLuint *framebuffers) const inline void glGenFramebuffers (GLsizei n, GLuint *framebuffers) const
{ {
::glGenFramebuffers (n, framebuffers); ::glGenFramebuffers (n, framebuffers);
OpenGl_TRACE(glGenFramebuffers)
} }
inline void glGenRenderbuffers (GLsizei n, GLuint *renderbuffers) const inline void glGenRenderbuffers (GLsizei n, GLuint *renderbuffers) const
{ {
::glGenRenderbuffers (n, renderbuffers); ::glGenRenderbuffers (n, renderbuffers);
OpenGl_TRACE(glGenRenderbuffers)
} }
inline void glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint* size, GLenum *type, GLchar *name) const 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); ::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 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); ::glGetActiveUniform (program, index, bufSize, length, size, type, name);
OpenGl_TRACE(glGetActiveUniform)
} }
inline void glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders) const inline void glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders) const
{ {
::glGetAttachedShaders (program, maxCount, count, shaders); ::glGetAttachedShaders (program, maxCount, count, shaders);
OpenGl_TRACE(glGetAttachedShaders)
} }
inline GLint glGetAttribLocation (GLuint program, const GLchar *name) const 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 inline void glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params) const
{ {
::glGetFramebufferAttachmentParameteriv (target, attachment, pname, params); ::glGetFramebufferAttachmentParameteriv (target, attachment, pname, params);
OpenGl_TRACE(glGetFramebufferAttachmentParameteriv)
} }
inline void glGetProgramiv (GLuint program, GLenum pname, GLint* params) const inline void glGetProgramiv (GLuint program, GLenum pname, GLint* params) const
{ {
::glGetProgramiv (program, pname, params); ::glGetProgramiv (program, pname, params);
OpenGl_TRACE(glGetProgramiv)
} }
inline void glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) const inline void glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) const
{ {
::glGetProgramInfoLog (program, bufSize, length, infoLog); ::glGetProgramInfoLog (program, bufSize, length, infoLog);
OpenGl_TRACE(glGetProgramInfoLog)
} }
inline void glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params) const inline void glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params) const
{ {
::glGetRenderbufferParameteriv (target, pname, params); ::glGetRenderbufferParameteriv (target, pname, params);
OpenGl_TRACE(glGetRenderbufferParameteriv)
} }
inline void glGetShaderiv (GLuint shader, GLenum pname, GLint* params) const inline void glGetShaderiv (GLuint shader, GLenum pname, GLint* params) const
{ {
::glGetShaderiv (shader, pname, params); ::glGetShaderiv (shader, pname, params);
OpenGl_TRACE(glGetShaderiv)
} }
inline void glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) const inline void glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) const
{ {
::glGetShaderInfoLog (shader, bufSize, length, infoLog); ::glGetShaderInfoLog (shader, bufSize, length, infoLog);
OpenGl_TRACE(glGetShaderInfoLog)
} }
inline void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) const inline void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) const
{ {
::glGetShaderPrecisionFormat (shadertype, precisiontype, range, precision); ::glGetShaderPrecisionFormat (shadertype, precisiontype, range, precision);
OpenGl_TRACE(glGetShaderPrecisionFormat)
} }
inline void glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source) const inline void glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source) const
{ {
::glGetShaderSource (shader, bufSize, length, source); ::glGetShaderSource (shader, bufSize, length, source);
OpenGl_TRACE(glGetShaderSource)
} }
inline void glGetUniformfv (GLuint program, GLint location, GLfloat* params) const inline void glGetUniformfv (GLuint program, GLint location, GLfloat* params) const
{ {
::glGetUniformfv (program, location, params); ::glGetUniformfv (program, location, params);
OpenGl_TRACE(glGetUniformfv)
} }
inline void glGetUniformiv (GLuint program, GLint location, GLint* params) const inline void glGetUniformiv (GLuint program, GLint location, GLint* params) const
{ {
::glGetUniformiv (program, location, params); ::glGetUniformiv (program, location, params);
OpenGl_TRACE(glGetUniformiv)
} }
GLint glGetUniformLocation (GLuint program, const GLchar *name) const 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 inline void glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params) const
{ {
::glGetVertexAttribfv (index, pname, params); ::glGetVertexAttribfv (index, pname, params);
OpenGl_TRACE(glGetVertexAttribfv)
} }
inline void glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params) const inline void glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params) const
{ {
::glGetVertexAttribiv (index, pname, params); ::glGetVertexAttribiv (index, pname, params);
OpenGl_TRACE(glGetVertexAttribiv)
} }
inline void glGetVertexAttribPointerv (GLuint index, GLenum pname, void* *pointer) const inline void glGetVertexAttribPointerv (GLuint index, GLenum pname, void* *pointer) const
{ {
::glGetVertexAttribPointerv (index, pname, pointer); ::glGetVertexAttribPointerv (index, pname, pointer);
OpenGl_TRACE(glGetVertexAttribPointerv)
} }
inline GLboolean glIsFramebuffer (GLuint framebuffer) const inline GLboolean glIsFramebuffer (GLuint framebuffer) const
@ -451,176 +520,211 @@ public: //! @name OpenGL ES 2.0
inline void glLinkProgram (GLuint program) const inline void glLinkProgram (GLuint program) const
{ {
::glLinkProgram (program); ::glLinkProgram (program);
OpenGl_TRACE(glLinkProgram)
} }
inline void glReleaseShaderCompiler() const inline void glReleaseShaderCompiler() const
{ {
::glReleaseShaderCompiler(); ::glReleaseShaderCompiler();
OpenGl_TRACE(glReleaseShaderCompiler)
} }
inline void glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height) const inline void glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height) const
{ {
::glRenderbufferStorage (target, internalformat, width, height); ::glRenderbufferStorage (target, internalformat, width, height);
OpenGl_TRACE(glRenderbufferStorage)
} }
inline void glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void* binary, GLsizei length) const inline void glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void* binary, GLsizei length) const
{ {
::glShaderBinary (count, shaders, binaryformat, binary, length); ::glShaderBinary (count, shaders, binaryformat, binary, length);
OpenGl_TRACE(glShaderBinary)
} }
inline void glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length) const inline void glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length) const
{ {
::glShaderSource (shader, count, string, length); ::glShaderSource (shader, count, string, length);
OpenGl_TRACE(glShaderSource)
} }
inline void glUniform1f (GLint location, GLfloat v0) const inline void glUniform1f (GLint location, GLfloat v0) const
{ {
::glUniform1f (location, v0); ::glUniform1f (location, v0);
OpenGl_TRACE(glUniform1f)
} }
inline void glUniform1fv (GLint location, GLsizei count, const GLfloat* value) const inline void glUniform1fv (GLint location, GLsizei count, const GLfloat* value) const
{ {
::glUniform1fv (location, count, value); ::glUniform1fv (location, count, value);
OpenGl_TRACE(glUniform1fv)
} }
inline void glUniform1i (GLint location, GLint v0) const inline void glUniform1i (GLint location, GLint v0) const
{ {
::glUniform1i (location, v0); ::glUniform1i (location, v0);
OpenGl_TRACE(glUniform1i)
} }
inline void glUniform1iv (GLint location, GLsizei count, const GLint* value) const inline void glUniform1iv (GLint location, GLsizei count, const GLint* value) const
{ {
::glUniform1iv (location, count, value); ::glUniform1iv (location, count, value);
OpenGl_TRACE(glUniform1iv)
} }
inline void glUniform2f (GLint location, GLfloat v0, GLfloat v1) const inline void glUniform2f (GLint location, GLfloat v0, GLfloat v1) const
{ {
::glUniform2f (location, v0, v1); ::glUniform2f (location, v0, v1);
OpenGl_TRACE(glUniform2f)
} }
inline void glUniform2fv (GLint location, GLsizei count, const GLfloat* value) const inline void glUniform2fv (GLint location, GLsizei count, const GLfloat* value) const
{ {
::glUniform2fv (location, count, value); ::glUniform2fv (location, count, value);
OpenGl_TRACE(glUniform2fv)
} }
inline void glUniform2i (GLint location, GLint v0, GLint v1) const inline void glUniform2i (GLint location, GLint v0, GLint v1) const
{ {
::glUniform2i (location, v0, v1); ::glUniform2i (location, v0, v1);
OpenGl_TRACE(glUniform2i)
} }
inline void glUniform2iv (GLint location, GLsizei count, const GLint* value) const inline void glUniform2iv (GLint location, GLsizei count, const GLint* value) const
{ {
::glUniform2iv (location, count, value); ::glUniform2iv (location, count, value);
OpenGl_TRACE(glUniform2iv)
} }
inline void glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2) const inline void glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2) const
{ {
::glUniform3f (location, v0, v1, v2); ::glUniform3f (location, v0, v1, v2);
OpenGl_TRACE(glUniform3f)
} }
inline void glUniform3fv (GLint location, GLsizei count, const GLfloat* value) const inline void glUniform3fv (GLint location, GLsizei count, const GLfloat* value) const
{ {
::glUniform3fv (location, count, value); ::glUniform3fv (location, count, value);
OpenGl_TRACE(glUniform3fv)
} }
inline void glUniform3i (GLint location, GLint v0, GLint v1, GLint v2) const inline void glUniform3i (GLint location, GLint v0, GLint v1, GLint v2) const
{ {
::glUniform3i (location, v0, v1, v2); ::glUniform3i (location, v0, v1, v2);
OpenGl_TRACE(glUniform3i)
} }
inline void glUniform3iv (GLint location, GLsizei count, const GLint* value) const inline void glUniform3iv (GLint location, GLsizei count, const GLint* value) const
{ {
::glUniform3iv (location, count, value); ::glUniform3iv (location, count, value);
OpenGl_TRACE(glUniform3iv)
} }
inline void glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) const inline void glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) const
{ {
::glUniform4f (location, v0, v1, v2, v3); ::glUniform4f (location, v0, v1, v2, v3);
OpenGl_TRACE(glUniform4f)
} }
inline void glUniform4fv (GLint location, GLsizei count, const GLfloat* value) const inline void glUniform4fv (GLint location, GLsizei count, const GLfloat* value) const
{ {
::glUniform4fv (location, count, value); ::glUniform4fv (location, count, value);
OpenGl_TRACE(glUniform4fv)
} }
inline void glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3) const inline void glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3) const
{ {
::glUniform4i (location, v0, v1, v2, v3); ::glUniform4i (location, v0, v1, v2, v3);
OpenGl_TRACE(glUniform4i)
} }
inline void glUniform4iv (GLint location, GLsizei count, const GLint* value) const inline void glUniform4iv (GLint location, GLsizei count, const GLint* value) const
{ {
::glUniform4iv (location, count, value); ::glUniform4iv (location, count, value);
OpenGl_TRACE(glUniform4iv)
} }
inline void glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) const inline void glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) const
{ {
::glUniformMatrix2fv (location, count, transpose, value); ::glUniformMatrix2fv (location, count, transpose, value);
OpenGl_TRACE(glUniformMatrix2fv)
} }
inline void glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) const inline void glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) const
{ {
::glUniformMatrix3fv (location, count, transpose, value); ::glUniformMatrix3fv (location, count, transpose, value);
OpenGl_TRACE(glUniformMatrix3fv)
} }
inline void glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) const inline void glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) const
{ {
::glUniformMatrix4fv (location, count, transpose, value); ::glUniformMatrix4fv (location, count, transpose, value);
OpenGl_TRACE(glUniformMatrix4fv)
} }
inline void glUseProgram (GLuint program) const inline void glUseProgram (GLuint program) const
{ {
::glUseProgram (program); ::glUseProgram (program);
OpenGl_TRACE(glUseProgram)
} }
inline void glValidateProgram (GLuint program) const inline void glValidateProgram (GLuint program) const
{ {
::glValidateProgram (program); ::glValidateProgram (program);
OpenGl_TRACE(glValidateProgram)
} }
inline void glVertexAttrib1f (GLuint index, GLfloat x) const inline void glVertexAttrib1f (GLuint index, GLfloat x) const
{ {
::glVertexAttrib1f (index, x); ::glVertexAttrib1f (index, x);
OpenGl_TRACE(glVertexAttrib1f)
} }
inline void glVertexAttrib1fv (GLuint index, const GLfloat* v) const inline void glVertexAttrib1fv (GLuint index, const GLfloat* v) const
{ {
::glVertexAttrib1fv (index, v); ::glVertexAttrib1fv (index, v);
OpenGl_TRACE(glVertexAttrib1fv)
} }
inline void glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y) const inline void glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y) const
{ {
::glVertexAttrib2f (index, x, y); ::glVertexAttrib2f (index, x, y);
OpenGl_TRACE(glVertexAttrib2f)
} }
inline void glVertexAttrib2fv (GLuint index, const GLfloat* v) const inline void glVertexAttrib2fv (GLuint index, const GLfloat* v) const
{ {
::glVertexAttrib2fv (index, v); ::glVertexAttrib2fv (index, v);
OpenGl_TRACE(glVertexAttrib2fv)
} }
inline void glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z) const inline void glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z) const
{ {
::glVertexAttrib3f (index, x, y, z); ::glVertexAttrib3f (index, x, y, z);
OpenGl_TRACE(glVertexAttrib3f)
} }
inline void glVertexAttrib3fv (GLuint index, const GLfloat* v) const inline void glVertexAttrib3fv (GLuint index, const GLfloat* v) const
{ {
::glVertexAttrib3fv (index, v); ::glVertexAttrib3fv (index, v);
OpenGl_TRACE(glVertexAttrib3fv)
} }
inline void glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) const inline void glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) const
{ {
::glVertexAttrib4f (index, x, y, z, w); ::glVertexAttrib4f (index, x, y, z, w);
OpenGl_TRACE(glVertexAttrib4f)
} }
inline void glVertexAttrib4fv (GLuint index, const GLfloat* v) const inline void glVertexAttrib4fv (GLuint index, const GLfloat* v) const
{ {
::glVertexAttrib4fv (index, v); ::glVertexAttrib4fv (index, v);
OpenGl_TRACE(glVertexAttrib4fv)
} }
inline void glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer) const inline void glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer) const
{ {
::glVertexAttribPointer (index, size, type, normalized, stride, pointer); ::glVertexAttribPointer (index, size, type, normalized, stride, pointer);
OpenGl_TRACE(glVertexAttribPointer)
} }
public: //! @name OpenGL ES 3.0 public: //! @name OpenGL ES 3.0

View File

@ -404,22 +404,22 @@ Standard_Boolean OpenGl_RaytraceGeometry::AcquireTextures (const Handle(OpenGl_C
aTexture->Sampler()->SetImmutable(); aTexture->Sampler()->SetImmutable();
aHandle = theContext->arbTexBindless->glGetTextureSamplerHandleARB (aTexture->TextureId(), aTexture->Sampler()->SamplerID()); aHandle = theContext->arbTexBindless->glGetTextureSamplerHandleARB (aTexture->TextureId(), aTexture->Sampler()->SamplerID());
const GLenum anErr = glGetError(); const GLenum anErr = theContext->core11fwd->glGetError();
if (anErr != GL_NO_ERROR) if (anErr != GL_NO_ERROR)
{ {
theContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 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(); myTextureHandles.clear();
return Standard_False; return Standard_False;
} }
} }
theContext->arbTexBindless->glMakeTextureHandleResidentARB (aHandle); theContext->arbTexBindless->glMakeTextureHandleResidentARB (aHandle);
const GLenum anErr = glGetError(); const GLenum anErr = theContext->core11fwd->glGetError();
if (anErr != GL_NO_ERROR) if (anErr != GL_NO_ERROR)
{ {
theContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 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; 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) for (size_t aTexIter = 0; aTexIter < myTextureHandles.size(); ++aTexIter)
{ {
theContext->arbTexBindless->glMakeTextureHandleNonResidentARB (myTextureHandles[aTexIter]); theContext->arbTexBindless->glMakeTextureHandleNonResidentARB (myTextureHandles[aTexIter]);
const GLenum anErr = glGetError(); const GLenum anErr = theContext->core11fwd->glGetError();
if (anErr != GL_NO_ERROR) if (anErr != GL_NO_ERROR)
{ {
theContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 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; return Standard_False;
} }
} }
@ -513,11 +513,11 @@ Standard_Boolean OpenGl_RaytraceGeometry::UpdateTextureHandles (const Handle(Ope
aTexture->Sampler()->SetImmutable(); aTexture->Sampler()->SetImmutable();
aHandle = theContext->arbTexBindless->glGetTextureSamplerHandleARB (aTexture->TextureId(), aTexture->Sampler()->SamplerID()); aHandle = theContext->arbTexBindless->glGetTextureSamplerHandleARB (aTexture->TextureId(), aTexture->Sampler()->SamplerID());
const GLenum anErr = glGetError(); const GLenum anErr = theContext->core11fwd->glGetError();
if (anErr != GL_NO_ERROR) if (anErr != GL_NO_ERROR)
{ {
theContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 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(); myTextureHandles.clear();
return Standard_False; return Standard_False;
} }

View File

@ -350,13 +350,13 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
if (aDataPtr != NULL) if (aDataPtr != NULL)
{ {
const GLint anAligment = Min ((GLint )theImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes 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) #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 // 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 anExtraBytes = GLint(theImage->RowExtraBytes());
const GLint aPixelsWidth = GLint(theImage->SizeRowBytes() / theImage->SizePixelBytes()); 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 #endif
} }
@ -370,14 +370,14 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
applyDefaultSamplerParams (theCtx); applyDefaultSamplerParams (theCtx);
if (toPatchExisting) if (toPatchExisting)
{ {
glTexSubImage1D (GL_TEXTURE_1D, 0, 0, theCtx->core11fwd->glTexSubImage1D (GL_TEXTURE_1D, 0, 0,
theSizeXY.x(), theFormat.PixelFormat(), theFormat.DataType(), aDataPtr); theSizeXY.x(), theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
Unbind (theCtx); Unbind (theCtx);
return true; return true;
} }
// use proxy to check texture could be created or not // use proxy to check texture could be created or not
glTexImage1D (GL_PROXY_TEXTURE_1D, 0, anIntFormat, theCtx->core11fwd->glTexImage1D (GL_PROXY_TEXTURE_1D, 0, anIntFormat,
theSizeXY.x(), 0, theSizeXY.x(), 0,
theFormat.PixelFormat(), theFormat.DataType(), NULL); theFormat.PixelFormat(), theFormat.DataType(), NULL);
glGetTexLevelParameteriv (GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_WIDTH, &aTestWidth); glGetTexLevelParameteriv (GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
@ -390,10 +390,10 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
return false; return false;
} }
glTexImage1D (GL_TEXTURE_1D, 0, anIntFormat, theCtx->core11fwd->glTexImage1D (GL_TEXTURE_1D, 0, anIntFormat,
theSizeXY.x(), 0, theSizeXY.x(), 0,
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr); theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
if (glGetError() != GL_NO_ERROR) if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
{ {
Unbind (theCtx); Unbind (theCtx);
Release (theCtx.get()); Release (theCtx.get());
@ -419,7 +419,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
applyDefaultSamplerParams (theCtx); applyDefaultSamplerParams (theCtx);
if (toPatchExisting) if (toPatchExisting)
{ {
glTexSubImage2D (GL_TEXTURE_2D, 0, theCtx->core11fwd->glTexSubImage2D (GL_TEXTURE_2D, 0,
0, 0, 0, 0,
theSizeXY.x(), theSizeXY.y(), theSizeXY.x(), theSizeXY.y(),
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr); theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
@ -428,7 +428,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
{ {
// generate mipmaps // generate mipmaps
theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D); theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D);
if (glGetError() != GL_NO_ERROR) if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
{ {
myMaxMipLevel = 0; myMaxMipLevel = 0;
} }
@ -440,7 +440,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
#if !defined(GL_ES_VERSION_2_0) #if !defined(GL_ES_VERSION_2_0)
// use proxy to check texture could be created or not // use proxy to check texture could be created or not
glTexImage2D (GL_PROXY_TEXTURE_2D, 0, anIntFormat, theCtx->core11fwd->glTexImage2D (GL_PROXY_TEXTURE_2D, 0, anIntFormat,
theSizeXY.x(), theSizeXY.y(), 0, theSizeXY.x(), theSizeXY.y(), 0,
theFormat.PixelFormat(), theFormat.DataType(), NULL); theFormat.PixelFormat(), theFormat.DataType(), NULL);
glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth); glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
@ -455,17 +455,18 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
} }
#endif #endif
glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat, theCtx->core11fwd->glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
theSizeXY.x(), theSizeXY.y(), 0, theSizeXY.x(), theSizeXY.y(), 0,
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr); theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
GLenum anErr = glGetError(); GLenum anErr = theCtx->core11fwd->glGetError();
if (anErr != GL_NO_ERROR) if (anErr != GL_NO_ERROR)
{ {
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 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() TCollection_AsciiString ("Error: 2D texture ") + theSizeXY.x() + "x" + theSizeXY.y()
+ " IF: " + int(anIntFormat) + " PF: " + int(theFormat.PixelFormat()) + " IF: " + OpenGl_TextureFormat::FormatFormat (anIntFormat)
+ " DT: " + int(theFormat.DataType()) + " PF: " + OpenGl_TextureFormat::FormatFormat (theFormat.PixelFormat())
+ " can not be created with error " + int(anErr) + "."); + " DT: " + OpenGl_TextureFormat::FormatDataType (theFormat.DataType())
+ " can not be created with error " + OpenGl_Context::FormatGlError (anErr) + ".");
Unbind (theCtx); Unbind (theCtx);
Release (theCtx.get()); Release (theCtx.get());
return false; return false;
@ -479,7 +480,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
// generate mipmaps // generate mipmaps
//glHint (GL_GENERATE_MIPMAP_HINT, GL_NICEST); //glHint (GL_GENERATE_MIPMAP_HINT, GL_NICEST);
theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D); theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D);
anErr = glGetError(); anErr = theCtx->core11fwd->glGetError();
if (anErr != GL_NO_ERROR) if (anErr != GL_NO_ERROR)
{ {
myMaxMipLevel = 0; 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, 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() TCollection_AsciiString ("Error: 2D compressed texture ") + aMipSizeXY.x() + "x" + aMipSizeXY.y()
+ " IF: " + int(aFormat.Internal()) + " PF: " + int(aFormat.PixelFormat()) + " IF: " + OpenGl_TextureFormat::FormatFormat (aFormat.Internal())
+ " DT: " + int(aFormat.DataType()) + " PF: " + OpenGl_TextureFormat::FormatFormat (aFormat.PixelFormat())
+ " can not be created with error " + int(aTexImgErr) + "."); + " DT: " + OpenGl_TextureFormat::FormatDataType (aFormat.DataType())
+ " can not be created with error " + OpenGl_Context::FormatGlError (aTexImgErr) + ".");
Unbind (theCtx); Unbind (theCtx);
Release (theCtx.get()); Release (theCtx.get());
return false; return false;
@ -754,7 +756,7 @@ bool OpenGl_Texture::InitRectangle (const Handle(OpenGl_Context)& theCtx,
// setup the alignment // setup the alignment
OpenGl_UnpackAlignmentSentry::Reset(); OpenGl_UnpackAlignmentSentry::Reset();
glTexImage2D (GL_PROXY_TEXTURE_RECTANGLE, 0, mySizedFormat, theCtx->core11fwd->glTexImage2D (GL_PROXY_TEXTURE_RECTANGLE, 0, mySizedFormat,
aSizeX, aSizeY, 0, aSizeX, aSizeY, 0,
myTextFormat, GL_FLOAT, NULL); myTextFormat, GL_FLOAT, NULL);
@ -771,11 +773,11 @@ bool OpenGl_Texture::InitRectangle (const Handle(OpenGl_Context)& theCtx,
return false; return false;
} }
glTexImage2D (myTarget, 0, mySizedFormat, theCtx->core11fwd->glTexImage2D (myTarget, 0, mySizedFormat,
aSizeX, aSizeY, 0, aSizeX, aSizeY, 0,
myTextFormat, GL_FLOAT, NULL); myTextFormat, GL_FLOAT, NULL);
if (glGetError() != GL_NO_ERROR) if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
{ {
Unbind (theCtx); Unbind (theCtx);
return false; return false;
@ -868,7 +870,7 @@ bool OpenGl_Texture::Init3D (const Handle(OpenGl_Context)& theCtx,
aSizeXYZ.x(), aSizeXYZ.y(), aSizeXYZ.z(), 0, aSizeXYZ.x(), aSizeXYZ.y(), aSizeXYZ.z(), 0,
theFormat.PixelFormat(), theFormat.DataType(), thePixels); theFormat.PixelFormat(), theFormat.DataType(), thePixels);
if (glGetError() != GL_NO_ERROR) if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
{ {
Unbind (theCtx); Unbind (theCtx);
Release (theCtx.get()); 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, 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() TCollection_AsciiString ("Error: cubemap compressed texture ") + aMipSizeXY.x() + "x" + aMipSizeXY.y()
+ " IF: " + int(aFormat.Internal()) + " PF: " + int(aFormat.PixelFormat()) + " IF: " + OpenGl_TextureFormat::FormatFormat (aFormat.Internal())
+ " DT: " + int(aFormat.DataType()) + " PF: " + OpenGl_TextureFormat::FormatFormat (aFormat.PixelFormat())
+ " can not be created with error " + int(aTexImgErr) + "."); + " DT: " + OpenGl_TextureFormat::FormatDataType (aFormat.DataType())
+ " can not be created with error " + OpenGl_Context::FormatGlError (aTexImgErr) + ".");
Unbind (theCtx); Unbind (theCtx);
Release (theCtx.get()); Release (theCtx.get());
return false; return false;
@ -1049,13 +1052,13 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
{ {
#if !defined(GL_ES_VERSION_2_0) #if !defined(GL_ES_VERSION_2_0)
const GLint anAligment = Min ((GLint)anImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes 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 // 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 anExtraBytes = GLint(anImage->RowExtraBytes());
const GLint aPixelsWidth = GLint(anImage->SizeRowBytes() / anImage->SizePixelBytes()); const GLint aPixelsWidth = GLint(anImage->SizeRowBytes() / anImage->SizePixelBytes());
const GLint aRowLength = (anExtraBytes >= anAligment) ? aPixelsWidth : 0; const GLint aRowLength = (anExtraBytes >= anAligment) ? aPixelsWidth : 0;
glPixelStorei (GL_UNPACK_ROW_LENGTH, aRowLength); theCtx->core11fwd->glPixelStorei (GL_UNPACK_ROW_LENGTH, aRowLength);
#else #else
Handle(Image_PixMap) aCopyImage = new Image_PixMap(); Handle(Image_PixMap) aCopyImage = new Image_PixMap();
aCopyImage->InitTrash (theFormat, theSize, theSize); aCopyImage->InitTrash (theFormat, theSize, theSize);
@ -1071,7 +1074,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
} }
anImage = aCopyImage; anImage = aCopyImage;
const GLint anAligment = Min((GLint)anImage->MaxRowAligmentBytes(), 8); // OpenGL supports alignment upto 8 bytes 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 #endif
aData = anImage->Data(); aData = anImage->Data();
} }
@ -1086,7 +1089,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
theCubeMap->Next(); theCubeMap->Next();
} }
glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, theCtx->core11fwd->glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
anIntFormat, anIntFormat,
GLsizei(theSize), GLsizei(theSize), GLsizei(theSize), GLsizei(theSize),
0, aFormat.PixelFormat(), aFormat.DataType(), 0, aFormat.PixelFormat(), aFormat.DataType(),
@ -1094,11 +1097,11 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
OpenGl_UnpackAlignmentSentry::Reset(); OpenGl_UnpackAlignmentSentry::Reset();
const GLenum anErr = glGetError(); const GLenum anErr = theCtx->core11fwd->glGetError();
if (anErr != GL_NO_ERROR) if (anErr != GL_NO_ERROR)
{ {
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 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); Unbind (theCtx);
Release (theCtx.get()); Release (theCtx.get());
return false; return false;
@ -1108,11 +1111,11 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
if (theToGenMipmap && theCtx->arbFBO != NULL) if (theToGenMipmap && theCtx->arbFBO != NULL)
{ {
theCtx->arbFBO->glGenerateMipmap (myTarget); theCtx->arbFBO->glGenerateMipmap (myTarget);
const GLenum anErr = glGetError(); const GLenum anErr = theCtx->core11fwd->glGetError();
if (anErr != GL_NO_ERROR) if (anErr != GL_NO_ERROR)
{ {
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 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); Unbind (theCtx);
Release (theCtx.get()); Release (theCtx.get());
return false; return false;

View File

@ -16,6 +16,103 @@
#include <Image_SupportedFormats.hxx> #include <Image_SupportedFormats.hxx>
#include <OpenGl_Context.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 // function : FindFormat
// purpose : // purpose :

View File

@ -18,6 +18,7 @@
#include <Image_Format.hxx> #include <Image_Format.hxx>
#include <OpenGl_GlCore13.hxx> #include <OpenGl_GlCore13.hxx>
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <TCollection_AsciiString.hxx>
class OpenGl_Context; class OpenGl_Context;
@ -56,6 +57,12 @@ public:
Image_CompressedFormat theFormat, Image_CompressedFormat theFormat,
bool theIsColorMap); 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: public:
//! Empty constructor (invalid texture format). //! Empty constructor (invalid texture format).

View File

@ -57,7 +57,7 @@ void OpenGl_TileSampler::GrabVarianceMap (const Handle(OpenGl_Context)& theConte
if (anErr != GL_NO_ERROR) if (anErr != GL_NO_ERROR)
{ {
theContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_MEDIUM, 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; return;
} }
#else #else

View File

@ -20,6 +20,21 @@
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_VertexBuffer,OpenGl_Resource) 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 // function : OpenGl_VertexBuffer
// purpose : // purpose :
@ -128,9 +143,19 @@ bool OpenGl_VertexBuffer::init (const Handle(OpenGl_Context)& theGlCtx,
myComponentsNb = theComponentsNb; myComponentsNb = theComponentsNb;
myElemsNb = theElemsNb; myElemsNb = theElemsNb;
theGlCtx->core15fwd->glBufferData (GetTarget(), GLsizeiptr(myElemsNb) * theStride, theData, GL_STATIC_DRAW); 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); 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 GLintptr(theElemFrom) * GLintptr (myComponentsNb) * aDataSize, // offset in bytes
GLsizeiptr(theElemsNb) * GLsizeiptr(myComponentsNb) * aDataSize, // size in bytes GLsizeiptr(theElemsNb) * GLsizeiptr(myComponentsNb) * aDataSize, // size in bytes
theData); 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); Unbind (theGlCtx);
return isDone; return anErr == GL_NO_ERROR;
} }
// ======================================================================= // =======================================================================

View File

@ -32,6 +32,9 @@ public:
//! Helpful constants //! Helpful constants
static const GLuint NO_BUFFER = 0; static const GLuint NO_BUFFER = 0;
//! Format VBO target enumeration value.
Standard_EXPORT static TCollection_AsciiString FormatTarget (GLenum theTarget);
public: public:
//! Create uninitialized VBO. //! Create uninitialized VBO.

View File

@ -2580,7 +2580,7 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer* theReadFbo,
aCtx->arbFBOBlit->glBlitFramebuffer (0, 0, aReadSizeX, aReadSizeY, aCtx->arbFBOBlit->glBlitFramebuffer (0, 0, aReadSizeX, aReadSizeY,
0, 0, aDrawSizeX, aDrawSizeY, 0, 0, aDrawSizeX, aDrawSizeY,
aCopyMask, GL_NEAREST); aCopyMask, GL_NEAREST);
const int anErr = ::glGetError(); const int anErr = aCtx->core11fwd->glGetError();
if (anErr != GL_NO_ERROR) if (anErr != GL_NO_ERROR)
{ {
// glBlitFramebuffer() might fail in several cases: // glBlitFramebuffer() might fail in several cases:
@ -2592,18 +2592,14 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer* theReadFbo,
// - Pixel formats of FBOs do not match. // - Pixel formats of FBOs do not match.
// This also might happen with window has pixel format, // This also might happen with window has pixel format,
// e.g. Mesa fails blitting RGBA8 -> RGB8 while other drivers support this conversion. // 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."; + " Please check your graphics driver settings or try updating driver.";
if (theReadFbo->NbSamples() != 0) if (theReadFbo->NbSamples() != 0)
{ {
myToDisableMSAA = true; myToDisableMSAA = true;
aMsg += "\n MSAA settings should not be overridden by driver!"; aMsg += "\n MSAA settings should not be overridden by driver!";
} }
aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, aMsg);
GL_DEBUG_TYPE_ERROR,
0,
GL_DEBUG_SEVERITY_HIGH,
aMsg);
} }
if (theDrawFbo != NULL if (theDrawFbo != NULL

View File

@ -37,16 +37,22 @@
#if(defined(_MSC_VER) && (_MSC_VER < 1800)) #if(defined(_MSC_VER) && (_MSC_VER < 1800))
// only Visual Studio 2013 (vc12) provides <cinttypes> header // only Visual Studio 2013 (vc12) provides <cinttypes> header
// we do not defined all macros here - only used by OCCT framework // we do not defined all macros here - only used by OCCT framework
#define PRIx64 "I64x"
#define PRIX64 "I64X"
#define PRId64 "I64d" #define PRId64 "I64d"
#define PRIu64 "I64u" #define PRIu64 "I64u"
#define SCNd64 "I64d" #define SCNd64 "I64d"
#define SCNu64 "I64u" #define SCNu64 "I64u"
#ifdef _WIN64 #ifdef _WIN64
#define PRIxPTR "I64x"
#define PRIXPTR "I64X"
#define PRIdPTR "I64d" #define PRIdPTR "I64d"
#define PRIuPTR "I64u" #define PRIuPTR "I64u"
#define SCNdPTR "I64d" #define SCNdPTR "I64d"
#define SCNuPTR "I64u" #define SCNuPTR "I64u"
#else #else
#define PRIxPTR "Ix"
#define PRIXPTR "IX"
#define PRIdPTR "d" #define PRIdPTR "d"
#define PRIuPTR "u" #define PRIuPTR "u"
#define SCNdPTR "d" #define SCNdPTR "d"