View Full Version : Render To Integer Texture

03-19-2010, 10:29 AM
I render scene to texture of GL_RGBA8UI format by FFP (without shader). It is necessary so that it would be mapped using CUDA functionality. But I get a white image on black background (black because cleared with zero color). Actually the question of whether FFP correctly draw in such texture?
I read a spec http://www.opengl.org/registry/specs/EXT/texture_integer.txt, but did not understand that.

03-19-2010, 11:34 AM
You can not use fixed function. Read that spec again:

INVALID_OPERATION is generated by Begin, DrawPixels, Bitmap,
CopyPixels, or a command that performs an explicit Begin if the
color buffer has an integer RGBA format and no fragment shader is

03-19-2010, 01:20 PM
Strange, but I do not get any errors, although the objects draw by Begin/End. Okay I'll have to write shaders that would draw a scene :(
PS: a result of CUDA kernel is integer texture to. But I render it with shader.

#version 150
uniform usampler2D TexUnit0;
out vec4 FragColor;
void main(void)

uvec3 intColor= texelFetch(TexUnit0, ivec2(gl_FragCoord.xy), 0).rgb;
FragColor = vec4(vec3(intColor)/ 255.0, 1.0);