Frage

I'm building water surfaces, where I want sinusoidal vertex shifting to get the effect of waves on the water. My understanding prior to picking up OpenGL was that this is best done in a geometry shader.

Presently, however, I'm working with the OpenGL ES 2.0 subset of OpenGL 2.1, strictly utilising the modern / programmable pipeline. Geometry shaders are not available in this version.

I have three options:

  • Do all vertex modifications on the CPU, and upload VBOs every single frame for all water surfaces, thus staying with OpenGL 2 only;
  • Move up to OpenGL 3.2 and use geometry shaders for this;
  • Use OpenGL 2 along with OpenCL to do modification of the vertices, with OpenCL using the GPU as it context to reduce the bottleneck.

Primarily I would like to keep things simple. So considering I don't know OpenCL (yet), perhaps I ought to stick with sending large batches to the CPU?

War es hilfreich?

Lösung

You don't need a geometry shader to displace vertices. Geometry shader is only really needed when you want to create new vertices (like for tessellation). If you want to just displace existing vertices by a sinusoidal wave you can do that easily in the vertex shader.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top