Hi
Does anyone have experience setting up a 2D texture that uses TFloat for its component-type? I am doing a Cg shader using texture-fetching to create a displacement map and would like to not have to convert my height-values to shorts…
So my question is, is there a way to make something like the following code snippet work?
self.texture = Texture(‘height_field’)
self.texture.setup2dTexture(Row,Col,Texture.TFloat,Texture.FRed)
p = PTAUchar.emptyArray(0)
p.setData(Z.tostring())
self.texture.setRamImage(CPTAUchar§)
In the example above, htArray is a (Row x Col) sized array of floats. When I try to run it I get an error saying that setRamImage only works with CPTAuchar, which is reasonable, but then is there an alternative to setRamImage for floats? Speed is somewhat of an issue as the source array is quite large (~1024x1024). So I guess writing to a file and then doing a texture.load is one option, but this seems like it will be slow. Any ideas?