I’d like to render into a buffer object, containing a sequence of integers, under GL-3 pure context. I’ve tried 2 different ways - both failed for unknown (for me) reason.
First approach - TBO.
I’m linking a texture of type R32i with this buffer as TBO. Then I create an FBO and attach the texture into it. It gives me FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT error. Digging up the spec, I found no reason why TBO can’t be attached as a render target.
Second approach - PBO.
I’m creating a 2D texture (could be 1D, but doesn’t matter here) in order to render into it and then read the values into my buffer bound as PBO. Surprisingly, TexImage2D fails with INVALID_OPERATION if the internal format is one of the R32i,R32ui or supposedly any other integer format. It’s 2011, haven’t ATI got integer texture support yet?
For a) GL_TEXTURE_BUFFER is not a valid texture target for glFramebufferTexture.
For b) You may have specified an invalid combination of ‘format’ and ‘type’. For integer texture internal formats, special new source format and type specifiers were introduced.
If you look through the paragraphs of FramebufferTextureXYZ(), you won’t find TEXTURE_BUFFER mentioned anywhere. So I concluded, it is probably not a valid texture target there.
For all other values of textarget, level must be greater than or equal to zero and no larger than log2 of the value of MAX_TEXTURE_SIZE. Otherwise, an INVALID_VALUE error is generated.
The spec doesn’t specify TextureBuffer as an exclusion, so it implicitly falls under “all other values of textarget”.
FramebufferTexture( enum target, enum attachment,
uint texture, int level );
…
An INVALID_OPERATION error is generated if texture is the name
of a buffer texture.