Sign in to follow this  

Red and Black squares with GL_RGBA16F_ARB

This topic is 3730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

As the title says, I'm getting screen full of red and black squares when I use RGBA16F in my framebuffer. I've just finished with some features with an game engine, but it seems that my card cannot handle 16bit floating point values or is there workaround or am I missing something? How stupid of me. Here's some code:
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
Texture
		color.loadEmpty(width, height, AGE_CLAMP_TO_EDGE, AGE_RGBA16F, true);
		depth.loadEmpty(width, height, AGE_CLAMP_TO_EDGE, AGE_DEPTH, true);

		glViewport(0, 0, width, height);

		glGenFramebuffersEXT(1, &fb);
		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

		glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, color.getTexid(), 0);
		glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, depth.getTexid(), 0);

		glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, depth.getTexid());

		GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
Frame buffer creation, loadempty creates just an empty texture container.
		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
		glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
		glPushAttrib(GL_VIEWPORT_BIT);
		glViewport(0, 0, width, height);
Framebuffer binding

Share this post


Link to post
Share on other sites
Your handling on the depth attachement is incorrect. First you're attaching a depth texture through glFramebufferTexture2DEXT, and just after that, you're attaching something undefined by using glFramebufferRenderbufferEXT with an invalid syntax.

Oh, and this is to anyone posting "it doesn't work" type of questions about OpenGL: please post the brand and type of graphics card you have. Answering such questions without this vital piece of information is often impossible.

Share this post


Link to post
Share on other sites
How stupid of me...

Ati Radeon x800GTO on dual screens.
AMD Athlon 3200+ 64Bit
1GB RAM

Oh, and thanks for the depth thing, I don't need it atm, and would've looked it up...

So is this purely because my GPU cannot handle floating point values? At least I don't get any errors when creating the FBO textures.

Also I use GL_FLOAT now as type paramter instead of GL_UNSIGNED_BYTE.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yann L
Your handling on the depth attachement is incorrect. First you're attaching a depth texture through glFramebufferTexture2DEXT, and just after that, you're attaching something undefined by using glFramebufferRenderbufferEXT with an invalid syntax.


Actually I think that is the way to do it when you are attaching a texture as the depth attachment. It works fine for me.

Share this post


Link to post
Share on other sites
Okaay.. So, I found out that the blue/black and red squares are just something in the background (gonna find how to get rid of em..) and my fps.. I mean spf is 25-50..

When I change back to RGBA8 my fps is around 130-160.

Share this post


Link to post
Share on other sites
Sign in to follow this