Pointer Textures?

There’s not much more to it. This is how it was initially.

At first it constantly complained about arrays of length-1 when I used numpy.zero to set up a 2d array,
so I changed that to 1024*1024 instead of (1024,1024). I think initially it was at (64,64,3), but I don’t recall exactly anymore.

		self.arr = numpy.zeros(1024*1024, numpy.float32)

		for x in xrange(0,1024*1024):
			self.arr[x] = 1.0;

		self.imageTexture = Texture("image")
		self.imageTexture.setup2dTexture(1024, 1024, Texture.TFloat , Texture.FRed) 

	 	p = PTAUchar.emptyArray(0)
		try:
		  p.setData(self.arr.tostring())
		except AssertionError:
		 	pass
		self.imageTexture.setRamImage(CPTAUchar(p))

I got this snipped from the web. It outputs a red texture. Swapping FRed to FBlue or FGreen yields black.
Changing anything yielded mostly errors and even if I didn’t get any errors, the texture was just messed up.

So how does it work? How can I avoid using tostring? Memoryview doesn’t work either,
it complains that there’s no support for buffers. Having it copied or being forced to
re-upload the whole texture every frame is not an option.

I don’t know what to do with this.

Edit:

Found it, it was this one: [Small issue with using numpy arrays as textures)

Doesn’t even work for me, it tells me that at p.setData(self.arr) there’s a TypeError,
that it expects a string or Unicode object, but instead it found a numpy.ndarray.