Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


FBO depth texture attachment


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 nico3000   Members   -  Reputation: 141

Like
0Likes
Like

Posted 19 August 2014 - 03:33 AM

Hi, I'm trying to setup a FBO with a single color attachment and a depth texture (no renderbuffer, because I want to read it in my shaders) attachment. Basically my code looks like this:

 

Depth texture generation:

glGenTextures(1, &depthTex);
glBindTexture(GL_TEXTURE_2D, depthTex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_STENCIL_TEXTURE_MODE, GL_DEPTH_COMPONENT);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT32, 1024, 1024);
glBindTexture(GL_TEXTURE_2D, 0);

Framebuffer generation:

glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
// attach color texture (works fine)
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTex, 0);
glCheckFramebufferStatus(GL_FRAMEBUFFER);

The problem now is after glFramebufferTexture2D I get an GL_INVALID_OPERATION. However if I do this

glBindTexture(GL_TEXTURE_2D, depthTex);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTex, 0);
glBindTexture(GL_TEXTURE_2D, 0);

instead, the glFramebufferTexture2D succeeds but afterwards I get GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT from glCheckFramebufferStatus().

 

My OpenGL initialized with version 4.4.0 and I'm using glew in it's most recent version. Does anyone have a clue what I'm doing wrong?

 

Edit: It doesn't make a difference if I bind the color attachment or not. However if I do not bind the depth attachment everything works fine.

 

Edit2: After 24 hours of debugging I found my error. It's nothing OpenGL related, so topic can be closed :)


Edited by nico3000, 19 August 2014 - 04:40 AM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS