Results 1 to 7 of 7

Thread: Curl effect

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    19

    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; \n"

    // "attribute vec4 a_position; \n"
    // "uniform float u_time; \n"
    "attribute vec2 a_texCoord; \n"
    "attribute vec3 a_startPosition; \n"
    "varying vec2 v_texCoord; \n"
    // "varying float v_lifetime; \n"


    "void main() \n"
    "{ \n"
    " gl_Position.xyz = a_startPosition.xyz; \n" //+ (u_time * a_endPosition);



    " gl_Position.w =1; \n" //keep it one if u want translation




    " v_texCoord =a_texCoord; \n"

    "} \n";

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

    "uniform sampler2D s_baseMap; \n"

    "void main() \n"
    "{ \n"
    " vec4 baseColor; \n"

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

    " gl_FragColor = baseColor ; \n"
    "} \n";

  2. #2
    Junior Member
    Join Date
    Jun 2012
    Posts
    19

    Re: Curl effect

    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

  3. #3
    Junior Member
    Join Date
    Jun 2012
    Posts
    19

    Re: Curl effect

    this is even better video

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

    pls help

  4. #4

    Re: Curl effect

    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

  5. #5
    Junior Member
    Join Date
    Jun 2012
    Posts
    19

    Re: Curl effect

    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

    please help me out with it again


  6. #6

    Re: Curl effect

    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.

  7. #7
    Junior Member
    Join Date
    Jun 2012
    Posts
    19

    Re: Curl effect

    i send u the code.

Similar Threads

  1. Fill Effect
    By klm_ in forum OpenGL ES general technical discussions
    Replies: 3
    Last Post: 03-07-2012, 01:49 AM
  2. GL_TEXTURE_2D: what's the effect?
    By Eymerich in forum OpenGL ES general technical discussions
    Replies: 0
    Last Post: 04-21-2008, 09:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •