Results 1 to 3 of 3

Thread: QGLWidget resize problem.

  1. #1

    Default QGLWidget resize problem.

    Hi,

    i'm using a QGLWidget in my class to establish a OpenGL Context. When i resize the QGLWidget using the resize method, the framebuffer will be resized as expected, but not the actual color target. For example, if i resize the widget to 1280x1024 and clear the scene using a red color, only a part of the scene will be cleared in red (as shown on the the following image)


    The class using the QGLWidget:
    Qt Code:
    1. class OpenGLExample
    2. {
    3. public:
    4. OpenGLExample()
    5. {
    6. widget.resize(1280,1024);
    7. widget.makeCurrent();
    8. }
    9.  
    10. void draw()
    11. {
    12. glClearColor(1.0f,0.0f,0.0f,0.0f);
    13. glClear(GL_COLOR_BUFFER_BIT);
    14. widget.grabFrameBuffer().save("test.png");
    15. }
    16. private:
    17. QGLWidget widget;
    18. };
    To copy to clipboard, switch view to plain text mode 
    And the main class:
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication app(argc,argv);
    4. OpenGLExample example;
    5. example.draw();
    6. return 0;
    7. }
    To copy to clipboard, switch view to plain text mode 

    glClear should affect the complete framebuffer and not only a part. Whats wrong with my code?

    Thanks!

  2. #2
    Join Date
    Jan 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QGLWidget resize problem.

    try to setup the viewport with glViewPort.

  3. #3

    Default Re: QGLWidget resize problem.

    I solved it.
    QGLWidget must be visible in order to get the resize working.

Similar Threads

  1. why linking problem with QGLWidget???
    By Shuchi Agrawal in forum Newbie
    Replies: 17
    Last Post: 16th March 2007, 11:45
  2. QMainWindow resize problem
    By edb in forum Qt Programming
    Replies: 5
    Last Post: 12th January 2007, 11:31
  3. Problem combining QWorkspace & QGLWidget
    By Nb2Qt in forum Qt Programming
    Replies: 1
    Last Post: 18th December 2006, 22:45
  4. QTable resize problem with large tables
    By Robzzz in forum Newbie
    Replies: 3
    Last Post: 22nd May 2006, 15:13
  5. QGLWidget renderText problem
    By mbjerkne in forum Qt Programming
    Replies: 1
    Last Post: 7th April 2006, 22:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.