Results 1 to 6 of 6

Thread: Qt OpenGL: Assertion Failed When Close the Window

  1. #1
    Join Date
    Jul 2012
    Posts
    53
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt OpenGL: Assertion Failed When Close the Window

    Hi,

    I'm writing a graphics program in Qt with OpenGL. When I try to close the program, there is a debug error says:

    Program: [directory of my program]
    Module: 4.7.2
    File: global\qglobal.cpp
    Line: 2262

    ASSERT: "group->context() == q_ptr" in file .\qgl.cpp, line 1657
    This error even occurs when I just close the example program (chap20\tetrahedron) of book "C++ GUI Programming with Qt 4, Second Edition".
    I'm using VS 2010 on Win 7 64bit, could anyone help me on this? Thanks.

  2. #2
    Join Date
    Aug 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt OpenGL: Assertion Failed When Close the Window

    Hi,
    I am experiencing exactly the same thing. Also VS 2010 with Windows 7, 64 Bit, Qt 2.8.2.
    Would be nice if someone would provide a hint.

    TIA,
    Alex

  3. #3
    Join Date
    Jul 2012
    Posts
    53
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt OpenGL: Assertion Failed When Close the Window

    Found the line causes the error:
    Qt Code:
    1. setFormat(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer));
    To copy to clipboard, switch view to plain text mode 
    Any thought of this?

  4. #4
    Join Date
    Aug 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt OpenGL: Assertion Failed When Close the Window

    Thank you, Seishin. It works. Now it would be interesting to learn why.

  5. #5

    Default Re: Qt OpenGL: Assertion Failed When Close the Window

    Hello,
    I've got the problem.

    This code crashes:
    Qt Code:
    1. OpenGlViewer::OpenGlViewer(QWidget *parent): QGLWidget(parent)
    2. {
    3. this->setFormat(QGLFormat(QGL::SampleBuffers));
    4. }
    To copy to clipboard, switch view to plain text mode 

    When I change the code to the following, it doesn't crash anymore:
    Qt Code:
    1. OpenGlViewer::OpenGlViewer(QWidget *parent): QGLWidget(QGLFormat(QGL::SampleBuffers),parent)
    2. {
    3. }
    To copy to clipboard, switch view to plain text mode 

    Like you guys I'd like to know the reason of this.
    Thank you for your time.

  6. #6
    Join Date
    Jul 2012
    Posts
    53
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt OpenGL: Assertion Failed When Close the Window

    Quote Originally Posted by Phys1k3r View Post
    Hello,
    I've got the problem.

    This code crashes:
    Qt Code:
    1. OpenGlViewer::OpenGlViewer(QWidget *parent): QGLWidget(parent)
    2. {
    3. this->setFormat(QGLFormat(QGL::SampleBuffers));
    4. }
    To copy to clipboard, switch view to plain text mode 

    When I change the code to the following, it doesn't crash anymore:
    Qt Code:
    1. OpenGlViewer::OpenGlViewer(QWidget *parent): QGLWidget(QGLFormat(QGL::SampleBuffers),parent)
    2. {
    3. }
    To copy to clipboard, switch view to plain text mode 

    Like you guys I'd like to know the reason of this.
    Thank you for your time.
    Yes that's how I solved it. But still not know the reason.

Similar Threads

  1. Replies: 9
    Last Post: 22nd February 2011, 21:19
  2. Replies: 2
    Last Post: 17th December 2010, 09:26
  3. Qt with OpenGL ES for ARM9 - All OpenGL ES tests have failed!
    By vinpa in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 3rd December 2009, 11:10
  4. Debug Assertion Failed
    By ^NyAw^ in forum General Programming
    Replies: 5
    Last Post: 28th December 2007, 12:48
  5. ASSERT(Failed assertion in Qt == Qt bug)
    By 0xBulbizarre in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2006, 20:06

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.