FBO problem

i render a scene including a teapot and ambient light .Without using fbo the whole scene seems ok!When i using fbo to render the scene into a texture,the light become dim. Why?

glGenFramebuffersEXT(1, &fb);
glGenTextures(1, &tex);
glGenRenderbuffersEXT(1, &depth_rb);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

glBindTexture(texTarget, tex);

glTexImage2D(texTarget,0,GL_RGBA,texWidth,texHeight,0,GL_RGBA,GL_FLOAT,0);

glTexParameterf(texTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(texTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(texTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(texTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depth_rb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, texWidth, texHeight);

glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);

glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex, 0);//new
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_rb);//new

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

With dim, I think you mean more dark ?

glTexImage2D(texTarget,0,GL_RGBA,texWidth,texHeight,0,GL_RGBA,GL_FLOAT,0);

You ask for an RGBA texture (so 4 channels of 1 byte each and and you use float, which is 4 bytes for each channel).
Try to use GL_UNSIGNED_BYTE instead of GL_FLOAT.

When the last parameter is 0, then whether you use GL_FLOAT or GL_UNSIGNED_BYTE doesn’t matter.

0 means you don’t intend to upload any texels. It means leave the memory location in whatever state it is in already.

The data storage is controlled by the 3rd parameter
http://www.opengl.org/wiki/Common_Mistakes#Image_precision

and also
http://www.opengl.org/wiki/Textures
where it says “The format, type, and data parameters are used for performing…etc”

When the last parameter is 0, then whether you use GL_FLOAT or GL_UNSIGNED_BYTE doesn’t matter.

Actually, that’s not true. The call can still fail if the pixel transfer formats don’t match the internal format for the basic pixel type. For example, if you’re creating a GL_DEPTH_COMPONENT24 internal format, you must use GL_DEPTH_COMPONENT for the pixel transfer format.

Yet another reason why texture_storage was long overdue…

So why how can i make the scene brighter ? what changes should i make?

GL_FLOAT is still the same.

I am not sure if this helps but I suspect maybe you have left the lighting on after rendering the scene to the fbo? Could u post the display function just to see whether there is anything else that might be causing this.

Yes, give us pertinent code (where you draw). You might don’t render the light in the same way (before or after the modelview transform for example).

Even if it is the same with GL_FLOAT (as posters said, this has no influence under this situation: no data given and not depth texture wanted), putting coherent arguments make the code more clean, more readable and more coherent: more pertinent and less prone to potential bugs.