We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
Is it possible to return data from a PShader ?
I'm using a vertex shader to update the vertices position of a PShape. I'd like to access this modified version to perform additional modifications inside draw() or at least use this modified version with the same PShader next time draw() is called.
Answers
Short answer: No. Although OpenGL does support Transform Feedback since version 3.0 (which offers the wanted features), PShader/Processing does not.
Long answer: Of course. Using "low level GL" you can utilize anything OpenGL has to offer:
But do you really need to? What kind of vertex modifications are we talking about? Displacement mapping, a simple heightmap mesh generation? How often do you need to manipulate/transform the shape's vertex data? Can the generation process be moved to the CPU?
A little example sketch portraining what you are trying to achieve would be helpful.
Hello,
I'm using different shaders to animate a PShape in different ways.
The first shader does some displacement mapping and the second one animates the PShape as a particles system.
I only need to edit the PShape (by saving the position of its vertices) when I choose to use another shader in order to create smooth transitions.
For the moment when I choose another shader, I start with the inital position of the vertices.
I have made a very simple sketch to explain what I'm trying to do:
https://www.dropbox.com/s/6i0a3trqz8r2olo/save_point_pshape.zip?dl=0
When you click on the sketch you can you choose another shader but as you will see I do not know how to save the last position of my vertices using opengl.
In my example I'd like to keep the last position of my PShape when I start to use "pointShader2".