Commit 2cfcec34 authored by Sylvain Thery's avatar Sylvain Thery
Browse files

update GLSL shader compil pb

parent a86afa8e
...@@ -105,7 +105,7 @@ protected: ...@@ -105,7 +105,7 @@ protected:
/** /**
* handle of program * handle of program
*/ */
CGoGNGLhandleARB m_program_object; CGoGNGLint m_program_object;
CGoGNGLint m_uniMat_Proj; CGoGNGLint m_uniMat_Proj;
CGoGNGLint m_uniMat_Model; CGoGNGLint m_uniMat_Model;
......
...@@ -275,7 +275,7 @@ bool GLSLShader::loadGeometryShader(const std::string& filename ) ...@@ -275,7 +275,7 @@ bool GLSLShader::loadGeometryShader(const std::string& filename )
bool GLSLShader::loadVertexShaderSourceString( const char *vertex_shader_source ) bool GLSLShader::loadVertexShaderSourceString( const char *vertex_shader_source )
{ {
int status; // int status;
char *info_log; char *info_log;
if (*m_vertex_shader_object==0) if (*m_vertex_shader_object==0)
...@@ -309,17 +309,28 @@ bool GLSLShader::loadVertexShaderSourceString( const char *vertex_shader_source ...@@ -309,17 +309,28 @@ bool GLSLShader::loadVertexShaderSourceString( const char *vertex_shader_source
/*** compile shader object ***/ /*** compile shader object ***/
glCompileShader( *m_vertex_shader_object ); glCompileShader( *m_vertex_shader_object );
glGetProgramiv( *m_vertex_shader_object, GL_OBJECT_COMPILE_STATUS_ARB, &status ); // glGetProgramiv( *m_vertex_shader_object, GL_OBJECT_COMPILE_STATUS_ARB, &status );
if( !status ) // if( !status )
// {
// CGoGNerr << "ERROR - GLshader::loadVertexShader() - error occured while compiling shader " << m_nameVS<< CGoGNendl;
// info_log = getInfoLog( *m_vertex_shader_object );
// CGoGNerr << info_log << CGoGNendl;
// delete [] info_log;
// glDeleteShader( *m_vertex_shader_object );
// *m_vertex_shader_object = 0;
// return false;
// }
info_log = getInfoLog( *m_vertex_shader_object );
if (info_log!=NULL)
{ {
CGoGNerr << "ERROR - GLshader::loadVertexShader() - error occured while compiling shader " << m_nameVS<< CGoGNendl; CGoGNerr << "ERROR - GLshader::loadVertexShader() - error occured while compiling shader " << m_nameVS<< CGoGNendl;
info_log = getInfoLog( *m_vertex_shader_object ); CGoGNerr << vertex_shader_source << CGoGNendl;
CGoGNerr << info_log << CGoGNendl; CGoGNerr << "----------------------------------------------------------------------------" << CGoGNendl;
delete [] info_log; delete [] info_log;
glDeleteShader( *m_vertex_shader_object ); glDeleteShader( *m_vertex_shader_object );
*m_vertex_shader_object = 0; *m_vertex_shader_object = 0;
return false; return false;
} }
...@@ -329,7 +340,7 @@ bool GLSLShader::loadVertexShaderSourceString( const char *vertex_shader_source ...@@ -329,7 +340,7 @@ bool GLSLShader::loadVertexShaderSourceString( const char *vertex_shader_source
bool GLSLShader::loadFragmentShaderSourceString( const char *fragment_shader_source ) bool GLSLShader::loadFragmentShaderSourceString( const char *fragment_shader_source )
{ {
int status; // int status;
char *info_log; char *info_log;
if (*m_fragment_shader_object==0) if (*m_fragment_shader_object==0)
...@@ -363,17 +374,28 @@ bool GLSLShader::loadFragmentShaderSourceString( const char *fragment_shader_sou ...@@ -363,17 +374,28 @@ bool GLSLShader::loadFragmentShaderSourceString( const char *fragment_shader_sou
/*** compile shader object ***/ /*** compile shader object ***/
glCompileShader( *m_fragment_shader_object ); glCompileShader( *m_fragment_shader_object );
glGetProgramiv( *m_fragment_shader_object, GL_OBJECT_COMPILE_STATUS_ARB, &status ); // glGetProgramiv( *m_fragment_shader_object, GL_OBJECT_COMPILE_STATUS_ARB, &status );
if( !status ) // if( !status )
// {
// CGoGNerr << "ERROR - GLshader::loadFragmentShader() - error occured while compiling shader " << m_nameFS << CGoGNendl;
// info_log = getInfoLog( *m_fragment_shader_object );
// CGoGNerr << info_log << CGoGNendl;
// delete [] info_log;
// glDeleteShader( *m_fragment_shader_object );
// *m_fragment_shader_object = 0;
// return false;
// }
info_log = getInfoLog( *m_vertex_shader_object );
if (info_log!=NULL)
{ {
CGoGNerr << "ERROR - GLshader::loadFragmentShader() - error occured while compiling shader " << m_nameFS << CGoGNendl; CGoGNerr << "ERROR - GLshader::loadFragmentShader() - error occured while compiling shader " << m_nameFS<< CGoGNendl;
info_log = getInfoLog( *m_fragment_shader_object ); CGoGNerr << fragment_shader_source << CGoGNendl;
CGoGNerr << info_log << CGoGNendl; CGoGNerr << "----------------------------------------------------------------------------" << CGoGNendl;
delete [] info_log; delete [] info_log;
glDeleteShader( *m_fragment_shader_object ); glDeleteShader( *m_fragment_shader_object );
*m_fragment_shader_object = 0; *m_fragment_shader_object = 0;
return false; return false;
} }
...@@ -383,7 +405,7 @@ bool GLSLShader::loadFragmentShaderSourceString( const char *fragment_shader_sou ...@@ -383,7 +405,7 @@ bool GLSLShader::loadFragmentShaderSourceString( const char *fragment_shader_sou
bool GLSLShader::loadGeometryShaderSourceString( const char *geom_shader_source ) bool GLSLShader::loadGeometryShaderSourceString( const char *geom_shader_source )
{ {
int status; // int status;
char *info_log; char *info_log;
if (*m_geom_shader_object==0) if (*m_geom_shader_object==0)
...@@ -416,17 +438,27 @@ bool GLSLShader::loadGeometryShaderSourceString( const char *geom_shader_source ...@@ -416,17 +438,27 @@ bool GLSLShader::loadGeometryShaderSourceString( const char *geom_shader_source
/*** compile shader object ***/ /*** compile shader object ***/
glCompileShader( *m_geom_shader_object ); glCompileShader( *m_geom_shader_object );
glGetProgramiv( *m_geom_shader_object, GL_OBJECT_COMPILE_STATUS_ARB, &status ); // glGetProgramiv( *m_geom_shader_object, GL_OBJECT_COMPILE_STATUS_ARB, &status );
if( !status ) // if( !status )
// {
// CGoGNerr << "ERROR - GLshader::loadGeometryShader() - error occured while compiling shader "<< m_nameGS << CGoGNendl;
// info_log = getInfoLog( *m_geom_shader_object );
// CGoGNerr << info_log << CGoGNendl;
// delete [] info_log;
// glDeleteShader( *m_geom_shader_object );
// *m_geom_shader_object = 0;
// return false;
// }
info_log = getInfoLog( *m_geom_shader_object );
if (info_log!=NULL)
{ {
CGoGNerr << "ERROR - GLshader::loadGeometryShader() - error occured while compiling shader "<< m_nameGS << CGoGNendl; CGoGNerr << "ERROR - GLshader::loadGeometryShader() - error occured while compiling shader " << m_nameGS<< CGoGNendl;
info_log = getInfoLog( *m_geom_shader_object );
CGoGNerr << info_log << CGoGNendl; CGoGNerr << info_log << CGoGNendl;
delete [] info_log; delete [] info_log;
glDeleteShader( *m_geom_shader_object ); glDeleteShader( *m_geom_shader_object );
*m_geom_shader_object = 0; *m_geom_shader_object = 0;
return false; return false;
} }
...@@ -440,14 +472,19 @@ char* GLSLShader::getInfoLog( GLuint obj ) ...@@ -440,14 +472,19 @@ char* GLSLShader::getInfoLog( GLuint obj )
int info_log_length; int info_log_length;
int length; int length;
glGetProgramiv( obj, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_log_length ); glGetShaderiv(obj, GL_INFO_LOG_LENGTH, &info_log_length);
if (info_log_length <= 1)
return NULL;
info_log = new char [info_log_length]; info_log = new char [info_log_length];
glGetProgramInfoLog( obj, info_log_length, &length, info_log ); glGetShaderInfoLog( obj, info_log_length, &length, info_log );
return info_log; return info_log;
} }
bool GLSLShader::create(GLint inputGeometryPrimitive,GLint outputGeometryPrimitive, int nb_max_vertices) bool GLSLShader::create(GLint inputGeometryPrimitive,GLint outputGeometryPrimitive, int nb_max_vertices)
{ {
int status; int status;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment