how to change the vertex position
continuously in draw function and update it in the display
for example
GLfloat vVertices[] = { -0.5f, 0.5f, 0.0f, // Position 0
0.0f, 0.0f, // TexCoord 0
i want the postion (-.5,.5,0) to change from (0,0,1.5) to (-.5,.5,0) in steps of .1
like (0,0,1.5) -> (.1, .1, 1.4) ->(.2, .2, 1.3) … to (-.5,.5,0) and this change in vertex position of the image must be reflected in display
Hi,
I am not sure whether i got your question correctly.
Ohk , if you want to change vertex positions continuously , i can suggest you two options.
you can call draw function in loop.
In your draw function,take a static variable. Now while initializing your vertex array, you can change it my arithmetic operator.
vertices[]={0.5 +var, 0.7+var}
so that every time it will take different vertex array.
No need to change vertex array in loop. You can take uniform variable in shader and do like this:
gl_Position=(uniform_var * vertices.x)
But while calling glDraw in loop, you have set uniform var to your expected value by glUniformi() call.
I am not able to understand the scenario clearly. Can you paste your code here and explain it again ?
You can PM me if you don’t want to share publicly.