PDA

View Full Version : A texture conundrum



Grimfate202
03-21-2011, 09:17 PM
I have a (giant) array of data generated from an algorithm that I want to send to the vertex shader for displacement mapping. It sounds simple, but yet I am lost as to how to do it.

The data obviously has to be sent through a texture due to its massive size. The array is a normal float array, but the values in it are regenerated every frame. How can I update the data sent to the shader per frame? I thought of manually changing the texture data, but there seems to be no way to pass that on. As soon as you call glTexImage2D the image data cannot be changed.

I could render to a texture but that would mean implementing the algorithm in the shader, which is not a possibility.

How can I solve this?

Thanks

Grimfate202
03-21-2011, 09:31 PM
Of course, as soon as i post this i find something.

It seems PBO's are good at streaming textures, so ill look into those.

ZbuffeR
03-22-2011, 06:15 AM
Indeed, PBO will help.

As soon as you call glTexImage2D the image data cannot be changed. Not true, as you can do glTexSubImage2D.