diff --git a/examples/glEvalLimit/glEvalLimit.cpp b/examples/glEvalLimit/glEvalLimit.cpp index 4361b371..d2fa1ac1 100644 --- a/examples/glEvalLimit/glEvalLimit.cpp +++ b/examples/glEvalLimit/glEvalLimit.cpp @@ -977,6 +977,12 @@ uninitGL() { glDeleteVertexArrays(1, &g_samplesVAO); } +//------------------------------------------------------------------------------ +static void +callbackErrorGLFW(int error, const char* description) { + fprintf(stderr, "GLFW Error (%d) : %s\n", error, description); +} + //------------------------------------------------------------------------------ static void setGLCoreProfile() { @@ -1019,9 +1025,9 @@ int main(int argc, char **argv) { Far::SetErrorCallback(callbackError); - initShapes(); + glfwSetErrorCallback(callbackErrorGLFW); if (not glfwInit()) { printf("Failed to initialize GLFW\n"); return 1; diff --git a/examples/glFVarViewer/glFVarViewer.cpp b/examples/glFVarViewer/glFVarViewer.cpp index 91fea31e..f04cca50 100644 --- a/examples/glFVarViewer/glFVarViewer.cpp +++ b/examples/glFVarViewer/glFVarViewer.cpp @@ -1213,6 +1213,11 @@ callbackError(OpenSubdiv::Far::ErrorType err, const char *message) { printf("%s", message); } +//------------------------------------------------------------------------------ +static void +callbackErrorGLFW(int error, const char* description) { + fprintf(stderr, "GLFW Error (%d) : %s\n", error, description); +} //------------------------------------------------------------------------------ static void setGLCoreProfile() { @@ -1260,6 +1265,7 @@ int main(int argc, char ** argv) { OpenSubdiv::Far::SetErrorCallback(callbackError); + glfwSetErrorCallback(callbackErrorGLFW); if (not glfwInit()) { printf("Failed to initialize GLFW\n"); return 1; diff --git a/examples/glPaintTest/glPaintTest.cpp b/examples/glPaintTest/glPaintTest.cpp index ab6220ca..e1b70188 100644 --- a/examples/glPaintTest/glPaintTest.cpp +++ b/examples/glPaintTest/glPaintTest.cpp @@ -1110,6 +1110,11 @@ callbackError(OpenSubdiv::Far::ErrorType err, const char *message) { printf("%s", message); } +//------------------------------------------------------------------------------ +static void +callbackErrorGLFW(int error, const char* description) { + fprintf(stderr, "GLFW Error (%d) : %s\n", error, description); +} //------------------------------------------------------------------------------ static void setGLCoreProfile() { @@ -1154,6 +1159,7 @@ int main(int argc, char ** argv) { initShapes(); OpenSubdiv::Far::SetErrorCallback(callbackError); + glfwSetErrorCallback(callbackErrorGLFW); if (not glfwInit()) { printf("Failed to initialize GLFW\n"); return 1; diff --git a/examples/glPtexViewer/glPtexViewer.cpp b/examples/glPtexViewer/glPtexViewer.cpp index 35f37c3e..886338ec 100644 --- a/examples/glPtexViewer/glPtexViewer.cpp +++ b/examples/glPtexViewer/glPtexViewer.cpp @@ -2299,6 +2299,11 @@ callbackError(OpenSubdiv::Far::ErrorType err, const char *message) { printf("%s", message); } +//------------------------------------------------------------------------------ +static void +callbackErrorGLFW(int error, const char* description) { + fprintf(stderr, "GLFW Error (%d) : %s\n", error, description); +} //------------------------------------------------------------------------------ static void setGLCoreProfile() { @@ -2387,6 +2392,7 @@ int main(int argc, char ** argv) { return 1; } + glfwSetErrorCallback(callbackErrorGLFW); if (not glfwInit()) { printf("Failed to initialize GLFW\n"); return 1; diff --git a/examples/glShareTopology/glShareTopology.cpp b/examples/glShareTopology/glShareTopology.cpp index 72eb60bc..61dadd4f 100644 --- a/examples/glShareTopology/glShareTopology.cpp +++ b/examples/glShareTopology/glShareTopology.cpp @@ -1519,6 +1519,11 @@ callbackError(Far::ErrorType err, const char *message) { printf("%s", message); } +//------------------------------------------------------------------------------ +static void +callbackErrorGLFW(int error, const char* description) { + fprintf(stderr, "GLFW Error (%d) : %s\n", error, description); +} //------------------------------------------------------------------------------ static void setGLCoreProfile() { @@ -1554,6 +1559,7 @@ int main(int argc, char ** argv) { } Far::SetErrorCallback(callbackError); + glfwSetErrorCallback(callbackErrorGLFW); if (not glfwInit()) { printf("Failed to initialize GLFW\n"); return 1; diff --git a/examples/glStencilViewer/glStencilViewer.cpp b/examples/glStencilViewer/glStencilViewer.cpp index 037fed72..3cdd6589 100644 --- a/examples/glStencilViewer/glStencilViewer.cpp +++ b/examples/glStencilViewer/glStencilViewer.cpp @@ -980,6 +980,11 @@ uninitGL() { glDeleteVertexArrays(1, &g_stencilsVAO); } +//------------------------------------------------------------------------------ +static void +callbackErrorGLFW(int error, const char* description) { + fprintf(stderr, "GLFW Error (%d) : %s\n", error, description); +} //------------------------------------------------------------------------------ static void setGLCoreProfile() { @@ -1024,6 +1029,7 @@ int main(int argc, char **argv) { initShapes(); + glfwSetErrorCallback(callbackErrorGLFW); if (not glfwInit()) { printf("Failed to initialize GLFW\n"); return 1; diff --git a/examples/glViewer/glViewer.cpp b/examples/glViewer/glViewer.cpp index 3291ee06..7ffcc404 100644 --- a/examples/glViewer/glViewer.cpp +++ b/examples/glViewer/glViewer.cpp @@ -1479,14 +1479,12 @@ keyboard(GLFWwindow *, int key, int /* scancode */, int event, int /* mods */) { //------------------------------------------------------------------------------ static void -rebuildOsdMesh() -{ +rebuildOsdMesh() { createOsdMesh( g_defaultShapes[ g_currentShape ], g_level, g_kernel, g_defaultShapes[ g_currentShape ].scheme ); } static void -callbackDisplayStyle(int b) -{ +callbackDisplayStyle(int b) { if (g_displayStyle == kVaryingColor or b == kVaryingColor or g_displayStyle == kInterleavedVaryingColor or b == kInterleavedVaryingColor or g_displayStyle == kFaceVaryingColor or b == kFaceVaryingColor) { @@ -1499,8 +1497,7 @@ callbackDisplayStyle(int b) } static void -callbackKernel(int k) -{ +callbackKernel(int k) { g_kernel = k; #ifdef OPENSUBDIV_HAS_OPENCL @@ -1522,15 +1519,13 @@ callbackKernel(int k) } static void -callbackLevel(int l) -{ +callbackLevel(int l) { g_level = l; rebuildOsdMesh(); } static void -callbackModel(int m) -{ +callbackModel(int m) { if (m < 0) m = 0; @@ -1542,8 +1537,7 @@ callbackModel(int m) } static void -callbackAdaptive(bool checked, int /* a */) -{ +callbackAdaptive(bool checked, int /* a */) { if (OpenSubdiv::Osd::GLDrawContext::SupportsAdaptiveTessellation()) { g_adaptive = checked; rebuildOsdMesh(); @@ -1551,8 +1545,7 @@ callbackAdaptive(bool checked, int /* a */) } static void -callbackSingleCreasePatch(bool checked, int /* a */) -{ +callbackSingleCreasePatch(bool checked, int /* a */) { if (OpenSubdiv::Osd::GLDrawContext::SupportsAdaptiveTessellation()) { g_singleCreasePatch = checked; rebuildOsdMesh(); @@ -1560,8 +1553,7 @@ callbackSingleCreasePatch(bool checked, int /* a */) } static void -callbackCheckBox(bool checked, int button) -{ +callbackCheckBox(bool checked, int button) { switch (button) { case kHUD_CB_DISPLAY_CAGE_EDGES: g_drawCageEdges = checked; @@ -1594,8 +1586,7 @@ callbackCheckBox(bool checked, int button) } static void -initHUD() -{ +initHUD() { int windowWidth = g_width, windowHeight = g_height; int frameBufferWidth = g_width, frameBufferHeight = g_height; @@ -1680,8 +1671,7 @@ initHUD() //------------------------------------------------------------------------------ static void -initGL() -{ +initGL() { glClearColor(0.1f, 0.1f, 0.1f, 0.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); @@ -1712,15 +1702,19 @@ idle() { //------------------------------------------------------------------------------ static void -callbackError(OpenSubdiv::Far::ErrorType err, const char *message) { +callbackErrorOsd(OpenSubdiv::Far::ErrorType err, const char *message) { printf("Error: %d\n", err); printf("%s", message); } //------------------------------------------------------------------------------ static void -setGLCoreProfile() -{ +callbackErrorGLFW(int error, const char* description) { + fprintf(stderr, "GLFW Error (%d) : %s\n", error, description); +} +//------------------------------------------------------------------------------ +static void +setGLCoreProfile() { #define glfwOpenWindowHint glfwWindowHint #define GLFW_OPENGL_VERSION_MAJOR GLFW_CONTEXT_VERSION_MAJOR #define GLFW_OPENGL_VERSION_MINOR GLFW_CONTEXT_VERSION_MINOR @@ -1782,8 +1776,9 @@ int main(int argc, char ** argv) { g_fpsTimer.Start(); - OpenSubdiv::Far::SetErrorCallback(callbackError); + OpenSubdiv::Far::SetErrorCallback(callbackErrorOsd); + glfwSetErrorCallback(callbackErrorGLFW); if (not glfwInit()) { printf("Failed to initialize GLFW\n"); return 1;