Question

I have to small zone in left bottom corner for openGl painting. Im use QT widget. enter image description here

void GraphWidget::paintGL()
{
    glClear( GL_COLOR_BUFFER_BIT );

    glColor3f( 1 ,1 , 0 );

    glBegin( GL_POLYGON );
        glVertex2f( -0.5, -0.5 );
        glVertex2f( 0.5, -0.5 );
        glVertex2f( 0.5, 0.5 );
        glVertex2f( -0.5, 0.5 );
    glEnd();
}

I need to increase area of 'canvas' of opengl view.

Was it helpful?

Solution

It depends on how you are creating "canvas" of opengl view. In Qt, OpenGL only knows about the surface it needs to draw into, based on the Qt widget it is a part of. In your case, it appears that the widget itself is sized smaller than the mainwindow. So check how the widget you are drawing into, is created and sized. If you can share the code of the initialisation of the widget and how it is positioned in the mainwindow, it will be useful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top