Basically, my program uses frame buffer object to render to a 3D texture. If the 3D texture which I attach to fbo is in GL_RGB8 format, which is 24 bits per texel, there is no problem. Only 8-bits of them are used. The problem happens when I try to use GL_ALPHA8 (8 bits per texel) as the internal format for the 3D texture, the rendering result is blank. The cg fragment shader which I used to render to fbo looks like this:
void F_PureDecoder(
float3 vIndexCoord : TEXCOORD0,
out float color :COLOR)
{
... ...
color=float4(fL3,fL3,fL3,fL3);
}
Am I doing something wrong or fbo doesn't support to render to 8-bit texel texture? I am primarily unsure if the output format of fragment shader is correct. Coz the framebuffer is 8 bits but the output is 24 bits. Should I modify the output format from fragment shader? If so, what format should I use?
Thanks very much for any input!