opengl-tutorials
opengl-tutorials copied to clipboard
`glTexParameteri( GL_TEXTURE_2D_MULTISAMPLE ... ` calls throw errors
Getting GL errors with these lines:
glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // Prevents edge bleeding
glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Prevents edge bleeding
Looks like it's not valid to do that, the docs say:
GL_INVALID_ENUM is generated if the effective target is either GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY, and pname is any of the sampler states.
Found this out when my FBO wouldn't work for another reason. Checked each GL call with CHECK_GL macro:
bool GL_OK( int line, const char* file ) {
static map<int, string> glErrName = {
{ GL_NO_ERROR, "GL_NO_ERROR" },
{ GL_INVALID_ENUM, "GL_INVALID_ENUM" },
{ GL_INVALID_VALUE, "GL_INVALID_VALUE" },
{ GL_INVALID_OPERATION, "GL_INVALID_OPERATION" },
{ GL_STACK_OVERFLOW, "GL_STACK_OVERFLOW" },
{ GL_STACK_UNDERFLOW, "GL_STACK_UNDERFLOW" },
{ GL_OUT_OF_MEMORY, "GL_OUT_OF_MEMORY" },
};
GLenum err = glGetError() ;
if( err != GL_NO_ERROR ) {
printf( "GLERROR %d %s, line=%d of file=%s", err, glErrName[ err ].c_str(), line, file ) ;
}
return err == GL_NO_ERROR ;
}
// WITH LINE NUMBERS
#define CHECK_GL GL_OK( __LINE__, __FILE__ )