Retrieve Vertex Postion after Vertex Shader

Hi lovely Processing people,
is there a way (f.e. with low level GL) to retrieve Vertex Positions of an Object after they are displaced by a vertex shader?

//this displaces vertex
shader(displace);
shape(object);

//how to get diplaced postion for further referencing / drawing ?

Can i fetch a VertexBuffer or something similar?

Thanks for any help!

Jit

1 Like

I dont know much about OpenGL, but would you define a variable in your sketch and pass it to your shaders? Uniform comes into mind, but it is probably that is not the field that you should be using but something similar.

Kf

Hi, thank you. I already use uniforms to pipe informations into the shader(like framcount, seed, etc) but how to pass the new vertex positions out of the shader?

What i try to achieve: Atttaching other PShapes at the displaced vertex positions.

This might be feasible, but seems an odd thing to do. Can you not either transform the vertices in Processing code, or draw the shapes at their “normal” location and displace them with the same vertex shader?

You might also be interested in looking at codeanticode’s experiments with geometry and tessellation shaders? https://github.com/codeanticode/pshader-experiments

1 Like

Thank you neilcsmith. I will try to use the same (or slightly modified) vertex shader. I looked into the geom-shader examples and they are fantastic but a little bit to difficult for the timeframe of my current project.

After some hours of trying to use the same shader, i couldn’t make it. For the Task i’m performing it would be much better to retrieve vertex positions from a buffer or pass them out out the shader. What feasible way are you thinking of? How would it work? Thank you.

I think what you’re looking for is https://www.khronos.org/opengl/wiki/Transform_Feedback but I’m not sure that’s going to be any easier to implement.

1 Like

Wow. you are right maybe the geom shader solution is faster to implement. Thank you.