graphics

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e732ba8b82efac9b8835023bb09f17b4bce43bb2
parent 5cca0bf379ad040e7235194454ffd28dca7c9cc3
Author: Brian Swetland <swetland@frotz.net>
Date:   Thu, 12 Sep 2013 04:02:39 -0700

use printx() instead of fprintf() for correct debug print routing on win7

Diffstat:
Mcommon/glapp.cc | 18+++++++++---------
Mcommon/shaders.cc | 8++++----
2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/common/glapp.cc b/common/glapp.cc @@ -85,14 +85,14 @@ void App::setOptions(int argc, char **argv) { width = atoi(argv[0]); height = atoi(x + 1); } else { - fprintf(stderr,"unknown argument '%s'\n",argv[0]); + printx("unknown argument '%s'\n",argv[0]); } argv++; } } static void dump_gl_params(void) { -#define GGI(name) { int n = -1; glGetIntegerv(GL_##name, &n); fprintf(stderr, #name ": %d\n", n); } +#define GGI(name) { int n = -1; glGetIntegerv(GL_##name, &n); printx(#name ": %d\n", n); } GGI(MAX_TEXTURE_SIZE); GGI(MAX_3D_TEXTURE_SIZE); @@ -227,10 +227,10 @@ int App::start(void) { minor--; } if (!glcontext) { - fprintf(stderr,"cannot obtain OpenGL 3.1+ context\n"); + printx("cannot obtain OpenGL 3.1+ context\n"); exit(1); } else { - fprintf(stderr,"using OpenGL 3.%d\n", minor); + printx("using OpenGL 3.%d\n", minor); /* todo: verify extension availability */ } @@ -245,14 +245,14 @@ int App::start(void) { glEnable(GL_DEBUG_OUTPUT); // glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); } else { - fprintf(stderr,"warning: no glDebugMessageCallbackARB()\n"); + printx("warning: no glDebugMessageCallbackARB()\n"); } } - fprintf(stderr, "Vender: %s\n", glGetString(GL_VENDOR)); - fprintf(stderr, "Renderer: %s\n", glGetString(GL_RENDERER)); - fprintf(stderr, "GL Version: %s\n", glGetString(GL_VERSION)); - fprintf(stderr, "GLSL Version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION)); + printx("Vender: %s\n", glGetString(GL_VENDOR)); + printx("Renderer: %s\n", glGetString(GL_RENDERER)); + printx("GL Version: %s\n", glGetString(GL_VERSION)); + printx("GLSL Version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION)); dump_gl_params(); diff --git a/common/shaders.cc b/common/shaders.cc @@ -34,7 +34,7 @@ static void dump_compile_error(unsigned id) { memset(buf, 0, len); glGetShaderInfoLog(id, len, &len, buf); buf[len] = 0; - fprintf(stderr,"-- shader compiler error --\n%s\n", buf); + printx("-- shader compiler error --\n%s\n", buf); free(buf); } } @@ -48,7 +48,7 @@ static void dump_link_error(unsigned id) { memset(buf, 0, len); glGetProgramInfoLog(id, len, &len, buf); buf[len] = 0; - fprintf(stderr,"-- shader link error --\n%s\n", buf); + printx("-- shader link error --\n%s\n", buf); free(buf); } } @@ -87,7 +87,7 @@ int Program::link(VertexShader *vs, GeometryShader *gs, PixelShader *ps) { for (n = 0; n < sizeof(_blocknames) / sizeof(_blocknames[0]); n++) { unsigned idx = glGetUniformBlockIndex(id, _blocknames[n]); if (idx != GL_INVALID_INDEX) { - fprintf(stderr,"found %s @ %d\n", _blocknames[n], idx); + printx("found %s @ %d\n", _blocknames[n], idx); glUniformBlockBinding(id, idx, n); } } @@ -102,7 +102,7 @@ void Program::bind() { for (n = 0; n < sizeof(_samplernames) / sizeof(_samplernames[0]); n++) { r = glGetUniformLocation(id, _samplernames[n]); if (r != -1) { - fprintf(stderr,"found %s @ %d\n", _samplernames[n], r); + printx("found %s @ %d\n", _samplernames[n], r); glUniform1i(r, n); } }