2

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?

iKlsR
  • 2,642
  • 6
  • 27
  • 45
Engineer
  • 8,529
  • 7
  • 65
  • 105

1 Answers1

7

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.

Tim
  • 35,413
  • 11
  • 95
  • 121
  • 1
    "Geometry shader is only really needed when you want to create new vertices" Or to remove primitives, such as for frustum culling. Or to do [layered rendering](http://www.opengl.org/wiki/Framebuffer_Object#Layered_Images). Or other things. – Nicol Bolas Jul 15 '12 at 21:13