I having a problem with Shaders updating VBO, my question is
Can I have a shader that modify the vertex of a mesh and then recover the info of that modified vertex???
and if the answer is YES, How???
What I’m doing is this:
1.- The mesh geometry is in a VBO
2.- I applied the vertex shader to move the vertex…
3.- With glGetBufferData recover the supposing modified mesh data.
But when I check the data is the same as the source data.
I’m not sure that the shader modify the data of the VBO…
this is a piece of code of the shader
float k = heightMax - heightMin;
dv = texture2D(tex1,gl_MultiTexCoord0.xy);
float dim = (dimX + dimZ)0.5;
dim = dim * dv.y;
k = k * dv.y ;
k = (k + dim)0.1;
k = 10.0;
df = 0.30dv.x + 0.59dv.y + 0.11dv.z;
normal = normalize(gl_NormalMatrix * gl_Normal);
newVertexPos = gl_Vertex + vec4(gl_Normaldf*k,0.0);
gl_TexCoord = gl_MultiTexCoord0;
gl_Position = gl_ModelViewProjectionMatrix * newVertexPos;