changed GLW_STRINGFY to GLW_STRINGIFY, added printing of shader compile and program link logs to stderr.

This commit is contained in:
Marco Di Benedetto 2012-05-07 16:12:40 +00:00
parent d8897e798e
commit a9839c1673
4 changed files with 28 additions and 1 deletions

View File

@ -9,4 +9,8 @@
# define GLW_IMPLEMENT_CUSTOM_UNIFORMS # define GLW_IMPLEMENT_CUSTOM_UNIFORMS
#endif #endif
#ifndef GLW_PRINT_LOG_TO_STDERR
# define GLW_PRINT_LOG_TO_STDERR 1
#endif
#endif // GLW_CONFIG_H #endif // GLW_CONFIG_H

View File

@ -357,6 +357,13 @@ class Program : public Object
this->m_log = ThisType::getInfoLog(this->m_name); this->m_log = ThisType::getInfoLog(this->m_name);
this->m_linked = (linkStatus != GL_FALSE); this->m_linked = (linkStatus != GL_FALSE);
#if GLW_PRINT_LOG_TO_STDERR
std::cerr << "---------------------------" << std::endl;
std::cerr << "[Program Link Log]: " << ((this->m_linked) ? ("OK") : ("FAILED")) << std::endl;
std::cerr << this->m_log << std::endl;
std::cerr << "---------------------------" << std::endl;
#endif
if (this->m_linked) if (this->m_linked)
{ {
this->postLink(); this->postLink();

View File

@ -2,6 +2,7 @@
#define GLW_SHADER_H #define GLW_SHADER_H
#include <string> #include <string>
#include <iostream>
#include "./object.h" #include "./object.h"
@ -108,6 +109,21 @@ class Shader : public Object
this->m_source = source; this->m_source = source;
this->m_log = ThisType::getInfoLog(this->m_name); this->m_log = ThisType::getInfoLog(this->m_name);
this->m_compiled = (compileStatus != GL_FALSE); this->m_compiled = (compileStatus != GL_FALSE);
#if GLW_PRINT_LOG_TO_STDERR
std::cerr << "---------------------------" << std::endl;
std::cerr << "[";
switch (this->shaderType())
{
case GL_VERTEX_SHADER : std::cerr << "Vertex "; break;
case GL_GEOMETRY_SHADER : std::cerr << "Geometry "; break;
case GL_FRAGMENT_SHADER : std::cerr << "Fragment "; break;
default: break;
}
std::cerr << "Shader Compile Log]: " << ((this->m_compiled) ? ("OK") : ("FAILED")) << std::endl;
std::cerr << this->m_log << std::endl;
std::cerr << "---------------------------" << std::endl;
#endif
} }
private: private:

View File

@ -11,7 +11,7 @@
#include "./context.h" #include "./context.h"
#define GLW_STRINGFY(S) #S #define GLW_STRINGIFY(S) #S
#define GLW_OFFSET_OF(TYPE, MEMBER) ((const void *)(offsetof(TYPE, MEMBER))) #define GLW_OFFSET_OF(TYPE, MEMBER) ((const void *)(offsetof(TYPE, MEMBER)))
namespace glw namespace glw