3

I am using Java wrapper for OpenGL (LWJGL)I am getting

 GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT

status if I set FBO texture attachment format to be GL_RGBA16F.In fact Anything but GL_RGBA causes this error. Here is my FBO texture setup:

glBindTexture(GL_TEXTURE_2D, texId);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, _width, _height, 0, GL_RGBA, GL_FLOAT, (ByteBuffer) null);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glBindFramebuffer(GL_FRAMEBUFFER, _frameBuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texId, 0);
glDrawBuffers(GL_COLOR_ATTACHMENT0);

And here is the Depth attachment:

_depthBuffer = glGenRenderbuffers();
glBindRenderbuffer(GL_RENDERBUFFER, _depthBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, _width, _height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _depthBuffer);

UPDATE:

In fact ,if I swap places of internal format and format like this: GL_RGBA,GL_RGBA16F Than the FBO completes ok.But in the examples that I have seen the usage is that GL_RGBA16Fgoes first.

UPDATE1: So far got no answer from anybody on the LWJGL forum.Also submitted this issue as a bug but also got no answer from the dev team.If anybody else could test an FBO with texture attachment that uses float formats and report if the completeness is achieved that can be great.Currently I don't think there is an error in my code.Also I have tested it on 2 machines and got the same result.

Michael IV
  • 11,016
  • 12
  • 92
  • 223

2 Answers2

2

That was my mistake.I put GL_RGBA16F mistakenly as internal format parameter while passing GL_RGBA as the format.The issue solved.

Michael IV
  • 11,016
  • 12
  • 92
  • 223
  • 1
    Any particular reason you didn't award this to the guy who helped you to locate the issue? That's not very sporting of you. – Engineer Oct 07 '12 at 20:51
  • If you read carefully his answer and mine you can see that the solution he proposed was not the correct one.Also I lost the award anyway so I had no interest to "steal" it from anyone :) – Michael IV Oct 07 '12 at 21:27
  • As he said, "The GL_RGBA16F isn't available in OpenGL 3.3, maybe that is your problem?" Seems pretty clear to me. He assisted you in finding your problem. It seems only fair to give him the point. But whatever. – Engineer Oct 07 '12 at 21:33
  • Dear Nick , yes the issue was related to GL_RGBA16F but it was entirely unrelated to the answer above.I used GL4.0 for this project(see my comment below his answer) so I had this param in the API.The problem was that I mistakenly put into the param slot of the internal format and not of the format as prescribed by GL API.As you can see the author of the answer supplied no hint on this. – Michael IV Oct 07 '12 at 22:27
1

Your named texture is 'tex', but the texture you bind to the color attachment is 'texId'.

Edit:

I am using FBO, and get GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT when I try my application on Intel HD3000, but not on AMD or NVIDIA (OpenGL 4.2). The difference is that Intel HD3000 only supports OpenGL 3.1. The GL_RGBA16F isn't available in OpenGL 3.3, maybe that is your problem?

Lars Pensjö
  • 522
  • 2
  • 8
  • That is my typo here in the post.In the source the setup is divided into 2 functions.First creates texture ,second attaches it to the FBO.So the texture names are ok because in this code example I put together the code from those two methods and just forgot to rename tex to texId.Have you tried such a setup in LWJGL ? – Michael IV Jul 28 '12 at 08:06
  • Well in LWJGL the GL version is based on the API methods you select.But generally I am working with GL 4.0.I have 2 machines with NVidia GeForce 620GT and GeForce 550GT.Both give the same result.In fact ,using anything but RGBA gives me this error in FBO.Even if I use GL_RGBA8 . – Michael IV Jul 28 '12 at 08:46