Michael IV
Michael IV

Reputation: 11436

Getting incomplete FBO when setting GL_RGBA16F texture format

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.

Upvotes: 3

Views: 1795

Answers (2)

Michael IV
Michael IV

Reputation: 11436

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

Upvotes: 2

Lars Pensjö
Lars Pensjö

Reputation: 542

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?

Upvotes: 1

Related Questions