Results 1 to 2 of 2

Thread: vertexAttribPointer + stride + offest?

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    12

    vertexAttribPointer + stride + offest?

    vertexAttribPointer(uint index, int size, enum type,bool normalized, long stride, long offset)

    Hello.

    I'm trying figuring out what goes wrong when I try to call this method with a stride or offset <> 0.
    Could it be that webGL doesn't allow us to use those 2 parameters?

    Could anybody provide a short working code sample where stride and offset are set? (if the code is long you could put it on http://pastebin.com)

  2. #2

    Re: vertexAttribPointer + stride + offest?

    Hi,
    Please find the attached code.
    static GLfloat vertices1[]={-0.8f,-0.8f, -0.8f,-0.2f, -0.8f,-0.2f, -0.2f,-0.8f, -0.2f,-0.8f, -0.2f,-0.2f,-0.2f,-0.8f, -0.8f,-0.2f , -0.2f,-0.2f, 0.0f,0.6f,-0.8f,-0.2f,0.0f,0.0f};

    GLubyte buf[20],buf1[20];


    glClearColor(0.0, 0.0, 1.0, 1.0); // R,G,B,A
    glClear(GL_COLOR_BUFFER_BIT);


    glGenBuffers(1, &buffer);
    glBindBuffer(GL_ARRAY_BUFFER, buffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices1), vertices1,GL_STATIC_DRAW);
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer (2, GL_FLOAT, 4* sizeof(GLfloat), 0);

    3rd argument is stride is mentioned in number of bytes.
    PM me if you require any further help.

Similar Threads

  1. glTexSubImage2D with pitch/stride
    By ppettersson in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 1
    Last Post: 03-19-2011, 10:09 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
  •