Curl effect

i want to create a wrapping effect of the image as shown in the video ( http://www.youtube.com/watch?v=zy8YtRnX … re=related ) but on a continues bases when it rolls and wraps itself.

i am using opengl es 2.0

this is the code i could do till now. can you i get help please. how to modify the vertex shaders

GLbyte vShaderStr[] =
// "uniform mat4 u_mvpMatrix;
"

  // "attribute vec4 a_position;   

"
// "uniform float u_time;
"
"attribute vec2 a_texCoord;
"
"attribute vec3 a_startPosition;
"
"varying vec2 v_texCoord;
"
// "varying float v_lifetime;
"

   "void main()                  

"
"{
"
" gl_Position.xyz = a_startPosition.xyz;
" //+ (u_time * a_endPosition);

   "   gl_Position.w =1;  

" //keep it one if u want translation

   "   v_texCoord =a_texCoord;  

"

   "}                            

";

GLbyte fShaderStr[] =
"precision mediump float;
"
"varying vec2 v_texCoord;
"

 "uniform sampler2D s_baseMap;                        

"

  "void main()                                         

"
"{
"
" vec4 baseColor;
"

  "                                                    

"
" baseColor = texture2D( s_baseMap, v_texCoord );
"

  "  gl_FragColor = baseColor ;   

"
"}
";

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

please help me out

this is even better video

http://www.youtube.com/watch?v=GXAFisdn … ge#t=1017s

pls help

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.

  1. 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.

  2. 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.

hope this will help :slight_smile:

Thank you very much for the help.

i choose the second way

gl_Position=uniform var*vertices

i wanted to update the vertices using the update function which i will call using the esRegisterUpdateFunc ( &esContext, Update );

in the update function

i defined two identify matrices and using

esMatrixMultiply( &userData->vertices, &modelview, &modela );

i multiplied and stored it in vertices.

now i want to vary the values of the diagonal elements in the modelview matrix wrt to time.

void Update ( ESContext *esContext, float deltaTime )
{
UserData userData = (UserData) esContext->userData;

}

can you tell me how can i update the diagonal elements in the model view.

after i update it goes to vertices and updatefunction and then to vertexshader which alters the vertices.

Thank you very much debinair :slight_smile:

please help me out with it again

:slight_smile: :smiley:

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.

i send u the code.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.