Browse Source

better err msging

Former-commit-id: f73123840fb8b37de5df2b20d9b270f160977001
Alec Jacobson 10 years ago
parent
commit
f818acfbb3
1 changed files with 8 additions and 7 deletions
  1. 8 7
      include/igl/create_shader_program.cpp

+ 8 - 7
include/igl/create_shader_program.cpp

@@ -10,6 +10,7 @@
 
 #include "load_shader.h"
 #include "print_program_info_log.h"
+#include <iostream>
 #include <cstdio>
 
 IGL_INLINE bool igl::create_shader_program(
@@ -18,12 +19,12 @@ IGL_INLINE bool igl::create_shader_program(
   const std::map<std::string,GLuint> & attrib,
   GLuint & id)
 {
+  using namespace std;
   if(vert_source == "" && frag_source == "")
   {
-    fprintf(
-      stderr,
-      "Error: create_shader_program() could not create shader program,"
-      " both .vert and .frag source given were empty\n");
+    cerr<<
+      "create_shader_program() could not create shader program,"
+      " both .vert and .frag source given were empty"<<endl;
     return false;
   }
 
@@ -31,9 +32,7 @@ IGL_INLINE bool igl::create_shader_program(
   id = glCreateProgram();
   if(id == 0)
   {
-    fprintf(
-      stderr,
-      "Error: create_shader_program() could not create shader program.\n");
+    cerr<<"create_shader_program() could not create shader program."<<endl;
     return false;
   }
 
@@ -43,6 +42,7 @@ IGL_INLINE bool igl::create_shader_program(
     GLuint v = igl::load_shader(vert_source.c_str(),GL_VERTEX_SHADER);
     if(v == 0)
     {
+      cerr<<"vertex shader failed to compile."<<endl;
       return false;
     }
     glAttachShader(id,v);
@@ -54,6 +54,7 @@ IGL_INLINE bool igl::create_shader_program(
     GLuint f = igl::load_shader(frag_source.c_str(),GL_FRAGMENT_SHADER);
     if(f == 0)
     {
+      cerr<<"fragment shader failed to compile."<<endl;
       return false;
     }
     glAttachShader(id,f);