Sign in to follow this  
stringa

bad fbo code .... / glDrawArrays throws GL_INVALID_OP

Recommended Posts

I'm wondering what's wrong with this code. I'm limited it down to this call. The Code compiles fine and says that the FBO is complete. It's just when I call glDrawArrays(), I get an invalid operation. I've checked the few glBegin() / glEnd() call that I have and they are all complete. I've limited the error code down to this block of code.
  for( unsigned i = 0; i < MAX_SHADOW_MAPS; ++i )
  {
    ShadowMaps[i] = CreateDepthTexture( SHADOW_MAP_WIDTH, SHADOW_MAP_HEIGHT );
  }

  // ---- Create the Depth Textures

  glGenFramebuffersEXT( 1, &DepthRenderFBO_id );

  glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, DepthRenderFBO_id );

  // ---- Bind a Single Depth Buffer
  glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, ShadowMaps[0], 0);

  // ---- Let's Add a Texture
  BlankTextureFBO_id = CreateBlankTexture( SHADOW_MAP_WIDTH, SHADOW_MAP_HEIGHT );
  
  glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, BlankTextureFBO_id, 0);

  GLenum buffers[] = { GL_COLOR_ATTACHMENT0_EXT };

  glDrawBuffers( 1, buffers );
  
  // --- Check for Completeness

  if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) 
    throw(std::runtime_error(std::string("Error Setting up a Frame Buffer Object")));

  glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );




Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this