質問

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.

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top