Help on adding vertices via shader

I have read about being able to dynamically adding vertices and faces in the shader. However, I don’t understand how it is done. I looked over some examples but the basic idea is clouded with unrelated issues (animation, blending, texture data structures…) I simply want to understand how to dynamically at runtime add verticies in the shader. Is there a simple example of how to do this or can someone explain?

As a basic example for learning, can you tell me how to do this:
I have 1 triangle face (3 vertices). I send each vertex to the vertex shader for processing (The CPU only knows about these 3 vertices). In the shader, add 1 vertex per edge which will make a total of 6 vertices and 4 faces, from the original 3 vertices and 1 face.


You can’t. Vertex shaders don’t add vertices; they simply transform them.

Now, you can add empty vertices that you expect the vertex shader to position, but you have to do that by changing the vertex buffers you’re using.

Currently the only way to amplify geometry in GLSL is through the use of geometry shaders (requires NV G80+)

Not really intended as a general tessellator, but good for turning point and lines into quads, extruding shadow volumes, single pass rtt cubemap and such.

P.S. Looks like the GS has clinched a berth in the OpenGL 3.1 series

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.