Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: rotating VBO about x,y axes

  1. #1
    Intern Newbie
    Join Date
    Nov 2013

    rotating VBO about x,y axes

    My problem is that the model is not rotating about any recognizable z coordinate. I expect it to rotate about z = ctrz.

    Since my data is in a linked list instead of an array, I built the VBO using

    i = 0
    glBindBuffer(GL_ARRAY_BUFFER, vbobuffers[0]);
    gdata = (GLfloat*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
    while(data != NULL){
    gdata[i] = data->x;
    gdata[i+1] = data->y;
    gdata[i+2] = data->z;
    i += 3;
    data = data->next;

    then, in the mouse move callback function (dx & dy are the distances the mouse has been dragged)

    glTranslatef(ctrx, ctry, ctrz);
    glRotatef((theta -90*dx/WindowWidth), 0.0, 1.0, 0.0);
    glRotatef((phi -90*dy/WindowHeight), 1.0, 0.0, 0.0);
    glDrawArrays(GL_POINTS, 0, cardcount[GRID]);
    glRotatef(-(phi -90*dy/WindowHeight), 1.0, 0.0, 0.0);
    glRotatef(-(theta -90*dx/WindowWidth), 0.0, 1.0, 0.0);
    glTranslatef(-ctrx, -ctry, -ctrz);

    This scheme works perfectly when I am panning instead of rotating. It also works perfectly if i'm writing between glBegin() and glEnd().

  2. #2
    Intern Newbie
    Join Date
    Nov 2013
    Incidentally, the ctrz for my current model is ~1000, and the model maximum radius is 710. My VBO rendering appears be rotating about z=0 (?) regardless of translation of ctrz = +/- 1000

Posting Permissions

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