Poor rendering quality with FBOs

I’m currently trying to use FBOs in a project using wxWidget. All works fine, but the rendering quality is very poor on my video card (X700 mobility) whereas I didn’t see any problems when I tested the same program on two nvidia cards: GF6200 and GF7900.

This screen shows the results I have when I draw the datas contained in a FBO with wxWidget (in a wxBitmap).

The screen

Does anybody have an idea to explain this ?


Is that 256 color indexed mode ??
How do you setup your texture ? Do you request a precise color depth, such as 8 bit per color channel (best) ? If you let if to the default, you can have surprises like this.

Note the “GL_RGB8” instead of the deprecated GL_RGB :
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 512, 512, 0,

I’m using RGBA color.

It’s not a texture, it’s a renderBuffer in which I just drawn a GL_QUAD with two colors (white and blue).
The gradient is computed automatically (by opengl) by interpolating the two colors. It’s just 4 vertices rendered in 2D mode.

The depth buffer is desactivated with GL_DISABLE(GL_DEPTH_TEST);

The screen is what I got when I read the datas contained in the renderBuffer with:
glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_pBuffer);

And what about your OpenGL context setup ? which pixelformat do you request ?

I would check the ATI control panel settings to see if there is anything that might cause this. If the catalyst control center is not installed, you might want to try to install that huge thing.
Can you post the code for your FBO setup?

I’m guessing your implementation uses 8-bit or 12-bit color buffers. In OpenGL dithering is enabled by default, so it will have a significant impact on performance for lower-end machines. Try disabling GL_DITHER.

PS. You may want to check where exactly the dithering is being applied (opengl/widget) by writing out your m_pBuffer data to an image on disk.


I have no access to the source code right now. I’ll post some code as soon as possible.

V-man: “If the catalyst control center is not installed, you might want to try to install that huge thing.”
=> This software doesnt work fine on my labtop. I won’t any more install that. I just did the minimal installation.

Nico: “PS. You may want to check where exactly the dithering is being applied (opengl/widget) by writing out your m_pBuffer data to an image on disk.”
=> Exactly, in fact, the screen concerning my rendering (x700) is a picture saved to the disk directly from “m_pBuffer” since I wanted to be sure that this problem is not caused by wxWidget.

This looks very much like either your desktop is not 32 bit or your OpenGL context or you created Renderbuffer or RenderTexture have not 32 bit color. If you use a texture to render to you have to be sure to set GL_RGBA8 as internal format. If you are using a renderbuffer you would also have to make sure its internal format is GL_RGBA8. Also make sure your context is 32bits.

And maybe even though you request with this format some ATI driver settings might still give you some lower precision texture/renderbuffer. You could test this by explicitly querying the size of each component.

[ www.trenki.net | vector_math (3d math library) | software renderer ]

Here is the code used to create the FBOs:

// Creation of the FBO
glGenFramebuffersEXT(1, &m_GLframeBufferId);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_GLframeBufferId);

// Creation of the render buffer
glGenRenderbuffersEXT(1, &m_GLrenderBufferId);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_GLrenderBufferId);

// Render buffer attachment

// Unbind
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

Next, when I know the size of the render buffer, I create it.

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_GLframeBufferId);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_GLrenderBufferId);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA, _width, _height);



glViewport( 0, 0, _width, _height);

Next, I draw into the render buffer:

	glClearColor(1.0f, 0.0f, 1.0f, 1.0f);

	// Dessin du fond

	gluOrtho2D(0.0f, 1.0f, 0.0f, 1.0f);


	glColor3f(0.949f, 0.953f, 0.957f);
	glVertex2f(1.0f, 0.0f);
	glVertex2f(0.0f, 0.0f);
	glColor3f(0.735f, 0.888f, 0.972f);
	glVertex2f(0.0f, 1.0f);
	glVertex2f(1.0f, 1.0f);

And finally, I read the datas:

	glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
	glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_pBuffer);

	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);

As mentioned, I disable the GL_DITHER, and I obtain something better, but…
New screen

As specified on the screen, my desktop use 32bits colors.

Which driver have you installed? I have a laptop with ATI and drivers up to Catalyst 7.9 work fine (using DHModTool to get it to install, at all). Using Catalyst 7.10 my computer goes crazy.


And your OpenGL context that you use with wxwidget ? How do you set it up ?

try with :

glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, _width, _height);

Like ZbuffeR already pointed out, how are you setting up your OpenGL context (glut/glfw/…)? Could be that the problem is there…


I tried what Mazy suggested and it works well now.

Concerning GL_RGBA and GL_RGBA8, I found this note:

If you are willing to sacrifice some performance for improved visual quality, be sure to request GL_RGB8 or GL_RGBA8 internalformats. Otherwise you leave this decision in the hands of the person writing the driver, whose priorities may not match your own.

Thanks to all of you.

Jan: The last time I installed Catalyst, it worked for few months, after which I could any more access to the ati drivers options.