Question

I have a project that uses GLSL shaders.

This project is designed not to print anything to stdout unless something is going wrong or you explicitly turn on some extra debug output.

When a shader compile fails the log length given by glGetProgramInfoLog is >0, and sometimes when it succeeds its >0, and gives compile warnings instead. When you have a shader that compiles perfectly the log length is <1... this is how it works on my NVidia card on my dev machine.

For my sins, I also do some dev on a laptop with an intel integrated graphics card. The code runs fine, but whenever I do a shader compile the log contains:

"shader was successfully compiled to run on hardware"

Which is very annoying, as I now have no way to decide if I should print the string out, apart from some sort of string analysis, eg:

strstr("successfully",log)

Hopefully its obvious why that's undesirable. How, if at all, can I tell if a message is worth printing out using the OpenGL api?

EDIT:

If I use glGetShaderiv(shaderobj,GL_COMPILE_STATUS,&err); then I don't get compile warnings, only errors.

Was it helpful?

Solution

Here you go:

glGetShaderiv(shaderobj,GL_COMPILE_STATUS,&err);
if(!err) { /* now print out the error log */ }

This is the only compile status you get; there isn't any portable way I've found to determine if you've got warnings. (The compile log can be full of whatever the implementation cares to put in it, including notification of success.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top