<p>Based on the comment of "ratchet freak" I researched Transform Feedback Buffers and solved my problem that way.</p>

<p>I now generate the simulated points on the CPU and put them into a VertexBufferObject.
I generate a second VBO for the points (along with some others for velocity).
The connectivity of the cloth is given as an vertex-attribute in ivec4.</p>

<p>Using the transform feedback buffers and a Double-buffering trick using the two VBOs i can always read from the last step (using the connectivity info) and write to another buffer. This is in order to solve problems with concurrency. </p>

<p>The calculations are done in the vertex-shader as GL_POINTS.
Binding the output of the first shader into another regular shader using additional index-buffer to generate triangles I can without trouble render the cloth any way I want.</p>

<p>This idea follows the transform feedback buffer example made in the book "OpenGL Superbible" <a href="http://www.openglsuperbible.com/" rel="nofollow">http://www.openglsuperbible.com/</a></p>

CC BY-SA 3.0
2016-01-21T12:20:38.830Z
2016-01-21T12:20:38.830Z
Dragonseel
<p>I try to implement a position based cloth simulation using hardware tesselation.
This means I want to just upload a control quad to the graphics card and then use tesselation and geometry shading to create the nodes in the cloth.</p>

<p>This idea follows the paper:</p>

<p>Huynh, David, "Cloth simulation using hardware tessellation" (2011). Thesis. Rochester Institute of Technology
<a href="http://scholarworks.rit.edu/theses/265/">http://scholarworks.rit.edu/theses/265/</a></p>

<p>I know how to use tesselation to create the simulated points.
What I don't know is how to store the computated information into a framebuffer.</p>

<p>The geometry and also the tesselation evaluation shaders have informations needed for the per-vertex computations. But can they directly write into the framebuffer?</p>

<p>The fragment-shader I know can write to the framebuffer, but my information would be interpolated and I would no longer know what to write at which position.</p>

CC BY-SA 3.0
2016-01-16T17:02:05.970Z
transform feedback buffers
ratchet freak
CC BY-SA 3.0
2016-01-16T19:18:54.543Z
Sounds very good. The constraints of the cloth simulation make it necessary that I can access all neighbours of a particle (to calculate the spring forces). Can this be done with such buffers? In a geometry shader maybe? to pervent the feedback buffer to print each vertex multiple times I would like to use GL_POINTS. After a first look it seems that this makes it harder to calculate the springs.
Dragonseel
<opengl><shader><gpgpu><simulation>
Per Vertex Computation in OpenGL Tesselation
Dragonseel
# Per Vertex Computation in OpenGL Tesselation

(Asked by: username_0 on 2016-01-16)

I try to implement a position based cloth simulation using hardware tesselation.
This means I want to just upload a control quad to the graphics card and then use tesselation and geometry shading to create the nodes in the cloth.

This idea follows the paper:

Huynh, David, "Cloth simulation using hardware tessellation" (2011). Thesis. Rochester Institute of Technology
<http://scholarworks.rit.edu/theses/265/>

I know how to use tesselation to create the simulated points.
What I don't know is how to store the computated information into a framebuffer.

The geometry and also the tesselation evaluation shaders have informations needed for the per-vertex computations. But can they directly write into the framebuffer?

The fragment-shader I know can write to the framebuffer, but my information would be interpolated and I would no longer know what to write at which position.

**Tags:** opengl, shader, gpgpu, simulation

> **Comments:**
> **username_1**: transform feedback buffers  
> **username_0**: Sounds very good. The constraints of the cloth simulation make it necessary that I can access all neighbours of a particle (to calculate the spring forces). Can this be done with such buffers? In a geometry shader maybe? to pervent the feedback buffer to print each vertex multiple times I would like to use GL_POINTS. After a first look it seems that this makes it harder to calculate the springs.  

---

## 1 answers

### Answer by username_0 on 2016-01-21. Score: 3 | Accepted answer

Based on the comment of "username_1" I researched Transform Feedback Buffers and solved my problem that way.

I now generate the simulated points on the CPU and put them into a VertexBufferObject.
I generate a second VBO for the points (along with some others for velocity).
The connectivity of the cloth is given as an vertex-attribute in ivec4.

Using the transform feedback buffers and a Double-buffering trick using the two VBOs i can always read from the last step (using the connectivity info) and write to another buffer. This is in order to solve problems with concurrency.

The calculations are done in the vertex-shader as GL\_POINTS.
Binding the output of the first shader into another regular shader using additional index-buffer to generate triangles I can without trouble render the cloth any way I want.

This idea follows the transform feedback buffer example made in the book "OpenGL Superbible" <http://www.openglsuperbible.com/>


---

