Opengl polygon at a certain frame rate



  • Hello There,

    I have written a simple opengl polygon function to display a polygon. as a next step to this i would like to display this static polygon at a certain frame rate. what would be the best approach for doing this. I would like to avoid using GLUT.
    @
    void GLWidget::paintGL(){
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_POLYGON);
    glColor3f(0, 0, 0);
    glVertex2d(0,0);
    glColor3f(1, 1, 1);
    glVertex2d(3840,0);
    glColor3f(1, 1, 1);
    glVertex2d(3840,2160);
    glColor3f(0, 0, 0);
    glVertex2d(0,2160);
    glEnd();
    }@

    Here is my resize function

    @void GLWidget::resizeGL(int w, int h){
    HDC hdc = GetDC (NULL);
    int width = GetDeviceCaps (hdc, HORZRES);
    int height = GetDeviceCaps (hdc, VERTRES);
    ReleaseDC (NULL, hdc);

    glViewport(0,0,width,height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0f, 3840, 2160, 0.0f, -1.0f, 1.0f);
    
        glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    

    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.