Reputation: 3521
Tell me, please, how I can add new vertex in vertex shader?
Upvotes: 7
Views: 6221
Reputation: 3837
It's not possible to create new vertices using a vertex shader; it can only transform vertices. The Khronos documentation for the vertex shader states:
A vertex shader receives a single vertex from the vertex stream and generates a single vertex to the output vertex stream. There must be a 1:1 mapping from input vertices to output vertices.
There are several options for adding new vertices:
Upvotes: 0
Reputation: 9648
You can add vertices using a geometry shader http://www.opengl.org/wiki/Geometry_Shader
"A GS can create new primitives, unlike vertex shaders, which are limited to a 1:1 input to output ratio."
Upvotes: 3
Reputation: 59841
The vertex shader only transforms vertices. If you need to output additional geometry based on the input vertices a geometry shader is what you need.
Upvotes: 7