GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


OpenGL & Mouse Coords by Zak-
void drawHud() {
    GLint viewport[4];
    glGetIntegerv( GL_VIEWPORT, viewport );
    int W = viewport[2];
    int H = viewport[3];

    float hudPosX, hudPosY, hudHeight;
    hudPosX = 400;
    hudPosY = 390;
    hudHeight = 10;

    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();

    glOrtho(0,W,H,0,-1,10);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glDisable(GL_LIGHTING);


glColor4f(1,1,0.5,0.5);
glBegin(GL_LINES);
glVertex3f(400,400,0);
glVertex3f(200,200,0);
glEnd();
}