Imagination PowerVR SDK Blog

GL_INVALID_ENUM occurs in glGetFramebufferAttachme


#1

A GL_INVALID_ENUM error occurred when I acquired an object type for the attachment point that an object was not installed.

It occurs in the following source codes.

  GLuint renderbuffer = 0;
  glGenRenderbuffers( 1, &renderbuffer );
  glBindRenderbuffer( GL_RENDERBUFFER, renderbuffer );
  glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 256, 256 );

  GLuint framebuffer;
  glGenFramebuffers( 1, &framebuffer );
  glBindFramebuffer( GL_FRAMEBUFFER, framebuffer );
  glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderbuffer );

  if ( glCheckFramebufferStatus( GL_FRAMEBUFFER ) == GL_FRAMEBUFFER_COMPLETE ) {
      GLint type = 0;
      glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                             GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
                                             &type );
      GLenum error = glGetError();
      if ( error != GL_NO_ERROR ) {
          LOGE( “glGetError() == 0x%04xn”, error );
      }
  }

When I ran this, “glGetError() == 0x0500” was output. (GL_INVALID_ENUM)

GL_NONE should be returned to type without an error occurring.

I tested it in Galaxy S (SC-02B Android 2.3.3 GINGERBREAD.OMKE3).



#2

Hi PenCyot3,

Is the error definitely generated at this point? Have you tried putting earlier error checks to see if it’s another call that might be doing this?

Thanks,

Tobias




#3

The error was generated only at a place of glGetFramebufferAttachmentParameteriv().



I did the error check of all the GL commands in early stage, but erased other glGetError() to do a code clearly.