Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 01 Jan 2002
Offline Last Active Feb 14 2013 11:17 PM

Topics I've Started

converting to VBOs with glDrawElements from immediate mode

14 February 2013 - 03:14 PM

This draws a box.


     glBegin ( GL_LINE_STRIP );
        glVertex2i ( x0, y0 );
        glVertex2i ( x1, y0 );
        glVertex2i ( x1, y1 );
        glVertex2i ( x0, y1 );
        glVertex2i ( x0, y0 );
    glEnd ();

Now, to convert it to use VBO I have done



    GLint vertices[] = {x0,y0,x1,y0,x1,y1,x0,y1,x0,y0 };
    unsigned int indices[] = {0, 1, 2, 3,0};

    glBindBuffer(GL_ARRAY_BUFFER, buffers[0]);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_DYNAMIC_DRAW);

    glVertexPointer(2, GL_INT, 0, NULL);
    glDrawElements(GL_LINE_STRIP, 5, GL_UNSIGNED_INT, indices);


I must be doing something stupid, since it isn't working.  Instead of a box, it isn't drawing anything visable.

Not getting any GL errors either.

I can toggle the code above to go back to old code, and it works as it should.




Where did I mess up ?

calculating the "up" vector...

09 September 2009 - 06:19 PM

Greetings all, I am having some mental block, and I can't see what I am doing wrong with the way I am calculating the up vector. I calculate my up vector like so
up.x = cos(roll) * sin(yaw) * sin(pitch)  - sin(roll) * cos(roll);
up.y = cos(roll) * cos(pitch) ;
up.z = sin(roll) * sin(yaw)   + cos(roll)  * cos(yaw) *  sin(pitch) ;
I know I am doing something stupid, so if someone can shed some light on this, it will be most appreciated! TIA!