YYY
YYY

Reputation: 201

QT small image of opengl graphics

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.

Upvotes: 1

Views: 327

Answers (1)

Prabindh
Prabindh

Reputation: 3504

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.

Upvotes: 2

Related Questions