Initializing GL_List for processing.
glBegin(GL_POINTS);
for (i = 0; i < faceNum; i++)
{
mesh->GetFaceNodes(i
Since the shader does not contain any version information, it is a OpenGL Shading Language 1.10 Specification shader.
In GLSL 1.10 varying
variables of type int
are not allowed and implicit casts from int
to float
are not supported.
The glsl 1.10 there are no in
an out
variables. The keyword for intercace variables is varying
.
Furthermore the variable color
is not defined int eh fragment shader.
varying float final;
void main( void )
{
final = gl_Vertex.w;
// [...]
}
varying float final_tofrag;
void main( void )
{
if (final_tofrag < 0.0) // ?
gl_FragData[0] = vec4(final_tofrag, final_tofrag, -gl_FragCoord.z, 0.0);
else
gl_FragData[0] = vec4(final_tofrag, final_tofrag, gl_FragCoord.z, 0.0);
}
I recommend to check if the shader compilation succeeded and if the program object linked successfully.
If the compiling of a shader succeeded can be checked by glGetShaderiv and the parameter GL_COMPILE_STATUS
. e.g.:
#include
#include
bool CompileStatus( GLuint shader )
{
GLint status = GL_TRUE;
glGetShaderiv( shader, GL_COMPILE_STATUS, &status );
if (status == GL_FALSE)
{
GLint logLen;
glGetShaderiv( shader, GL_INFO_LOG_LENGTH, &logLen );
std::vector< char >log( logLen );
GLsizei written;
glGetShaderInfoLog( shader, logLen, &written, log.data() );
std::cout << "compile error:" << std::endl << log.data() << std::endl;
}
return status != GL_FALSE;
}
If the linking of a program was successful can be checked by glGetProgramiv and the parameter GL_LINK_STATUS
. e.g.:
bool LinkStatus( GLuint program )
{
GLint status = GL_TRUE;
glGetProgramiv( program, GL_LINK_STATUS, &status );
if (status == GL_FALSE)
{
GLint logLen;
glGetProgramiv( program, GL_INFO_LOG_LENGTH, &logLen );
std::vector< char >log( logLen );
GLsizei written;
glGetProgramInfoLog( program, logLen, &written, log.data() );
std::cout << "link error:" << std::endl << log.data() << std::endl;
}
return status != GL_FALSE;
}