Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glTexParameteri( GL_TEXTURE_2D_MULTISAMPLE ... calls throw errors #28

Open
superwills opened this issue Apr 7, 2024 · 1 comment
Open

Comments

@superwills
Copy link

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.

@superwills
Copy link
Author

superwills commented Apr 7, 2024

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__ ) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant