views:

327

answers:

1

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?

Thanks

EDIT:

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

+1  A: 

Here you go:

glGetShaderiv(shaderobj,GL_COMPILE_STATUS,&err);
if(!err) { /* now print out the error log */ }
Jay Kominek
Thanks for the reply edited my post.
DaedalusFall
So, you want to know if there are warnings, or errors, but not success messages? Sorry, I'm pretty sure that compile status is all there is.
Jay Kominek
Yes, thats exactly what I want.Shame, I guess I'll have to do it the messy way.Thanks.
DaedalusFall