First: Sorry for being all over this place.
So, I can’t give you much of working example code, but the relevant tidbits I can copy out.
Buffer creation:
def createBuffer(w,h):
b = base.win.makeTextureBuffer("",w,h)
b.setClearColor(Vec4(0, 0, 0, 0.0))
b.setClearColorActive(False)
b.clearDeleteFlag()
return b
def configTexture(b,ttype=None, tformat=None):
t = b.getTexture()
t.setMinfilter(Texture.FTNearest)
t.setMagfilter(Texture.FTNearest)
if (ttype != None): t.setComponentType(ttype)
if (tformat != None): t.setFormat(tformat)
return t
ObjectBuffer = createBuffer(1920/4,1025/4)
ObjectTexture = configTexture(ObjectBuffer,Texture.T_int,Texture.F_r32i)
Nothing fancy. This seems to work fine as it is with multiple floating point textures and a regular one, where I don’t set a format or component type. The T_int/F_r32i combination, though, gives me nothing.
The vertex shader is the one of the FullScreenTriangle and irrelevant for this case.
First Fragment Shader:
#version 130
out int gl_FragColor;
void main
{
gl_FragColor = 1;
}
In case you’ve noticed: gl_FragColor is deprecated. The quickest way to get rid of the super-annoying, horrible and constant nagging about it (i put up with it for a long time, can you tell? ) was to simply define gl_FragColor myself.
Second Fragment Shader:
#version 130
uniform isampler2D Objects;
out vec4 gl_FragColor;
void main
{
int object = texelFetch(Objects,ivec2(gl_FragCoord.xy * 4.0),0).r;
gl_FragColor = vec4( vec3(object), 1.0) ;
}
This yields nothing. Null. Black.
“show-buffers” is set to True, equally showing Black.
And to be clear: The value is Zero. My first thought was that “1 is close to 0, so d’uh it’s dark” but no…
I could pass the texture as floats, but that’s really just a bandaid.
I can use both memory and bandwith for better things.
What am I doing wrong?