alpha values getting clamped with FBO texture target

Started by
1 comment, last by djamelha 16 years, 6 months ago
Hi Im trying to render my scene to a texture and then use this texture in a blending operation. If I disable blending everything looks fine. However when I came to blending I discovered the alpha values were getting clamped to either 1.0 or 0.0. Im really confused and would really appreciate any suggestions. This is how I setup my frame buffer and texture:
// Setup our FBO
glGenFramebuffersEXT(1, &framebuffer);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer);

// Create the render buffer for depth
glGenRenderbuffersEXT(1, &depthBuffer);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthBuffer);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, TextureWidth, TextureHeight);

// Create texture
glGenTextures(1, &texture1);
glBindTexture(GL_TEXTURE_2D, texture1);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB,  TextureWidth, TextureHeight, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

// And attach it to the FBO so we can render to it
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture1, 0);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthBuffer);
Advertisement
Actually I think the alpha values are getting clamped to values greater than 1.0 which is even more confusing.
Hmm Ive just read in the opengl bible that with GL_RGBA16F_ARB the values dont get clamped into the range of 0.0,1.0. I think I should be able to solve my problem now, Il post an update with my solution incase anyone else has the same problem.

This topic is closed to new replies.

Advertisement