I need to create a 3d texture on the fly.
def createHalfToneTexture(self,depth,width,height):
tex = Texture()
tex.setupTexture(Texture.TT2dTexture, width,height,depth, Texture.TUnsignedByte, Texture.FLuminance);
p = tex.modifyRamImage()
for z in range(depth):
offset = width * height * z
for y in range(height):
for x in range(width):
index = (offset + width * y + x)
p.setElement(index, somevalue)
return tex
If I create a 2d texture using above code (set depth = 1), the 2d texture is correctly created.
But it seems not working for creating 3d texture (set depth > 1). How can I fix it ?