how to render to float32-rendertargets

what’s the difference between the third(internalFormat) and the seventh parameter(format) of glTexImage2D?

I want to render to float32 rendertargets by using the framebuffer object. When binding the texture to the framebuffer object, what kind of parameters should I set to specify that it does render in float32 format.

PS:
I want to create a summed-area table, so I need to render to the float32 render target. Someone suggest me to use the framebuffer object because it supports floating point values. But where does the difference between the default fb and fbo begin to occur? The time when binding a texture or a render buffer?

what’s the difference between the third(internalFormat) and the seventh parameter(format) of glTexImage2D?

The internal format is one of these. The pixel transfer format is one of these. Please take note of the notation at the bottom of the “Pixel format” section.

When binding the texture to the framebuffer object, what kind of parameters should I set to specify that it does render in float32 format.

None. If the texture you bind is a 32-bit-per-channel floating-point texture, then you will be rendering to a 32-bit-per-channel floating-point texture. If the texture you bind is an 8-bit-per-channel normalized integer texture, then you will be rendering to an 8-bit-per-channel normalized integer texture.

It’s really quite simple :wink:

But where does the difference between the default fb and fbo begin to occur?

I don’t know what you mean by this question. When you bind an FBO, you’re using the framebuffer object. When you unbind the FBO (by binding 0), you’re using the default framebuffer.

Thank you for your explanation.

None. If the texture you bind is a 32-bit-per-channel floating-point texture, then you will be rendering to a 32-bit-per-channel floating-point texture. If the texture you bind is an 8-bit-per-channel normalized integer texture, then you will be rendering to an 8-bit-per-channel normalized integer texture.

But why people say that fbo supports float32 rendertarget while default fb does not if the data format is totally determined by the rendertarget such as a texture?

But why people say that fbo supports float32 rendertarget while default fb does not if the data format is totally determined by the rendertarget such as a texture?

Simple: you cannot bind a render target to the default framebuffer. It comes with all its render targets built-in.

The default framebuffer is not an FBO. The default framebuffer is created at context creation time and is fixed for the duration of that context. And if the context represents a window (rather than a pbuffer), then it can only hold image formats that windows can actually display. Namely, unsigned, normalized integers, typically 8-bits per component.