PDA

View Full Version : Terrain vertex texture update



Hetzer
07-06-2012, 07:41 AM
Im using vertex texture as terrain height map. I dont have idea how update it.
Grid is writen as VAO, because somewhere i saw is a better to have own attributes then use a standart.

VAO as well as its texture coords are moving by camera.

I could create a "datacubes" witch have height data as buffer that was readed from file on another thread. For a every frame i could make a colision between each cubes and map, caculate region and update, but i dont think is efficient enought.

Something like this:
http://s13.postimage.org/ptf452xsz/VTF.jpg (http://postimage.org/image/ptf452xsz/)

Thanks

Alfonse Reinheart
07-06-2012, 10:16 AM
There is no such thing as a "vertex texture." All textures are the same, no matter what shader stage you access them from.

You update texture with glTexSubImage2D (http://www.opengl.org/wiki/GLAPI/glTexSubImage2D), possibly using a buffer object to transfer the data (http://www.opengl.org/wiki/Pixel_Buffer_Object).