Results 1 to 13 of 13

Thread: Qt Open Gl Programming in Netbeans IDE

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Qt Open Gl Programming in Netbeans IDE

    I am trying out an opengl application in ubuntu 10.04 using NetBeans IDE.
    The code is compiling perfectly but when running it, the application is giving a "segmentation fault". By debugging, I found that that the error is occurring in the constructor.
    I have already enabled the OpenGl in the Netbeans IDE. A "hello world" program, which just shows the Hello world in a label is executing properly.
    I give below some snippets of the code :

    Main.cpp
    Qt Code:
    1. read_file.getTestCase(test_case, test_data, ((randomize_pts == 'y') || (randomize_pts == 'Y') ? true : false));
    2. QApplication app(argc, argv);
    3.  
    4. if(!QGLFormat::hasOpenGL()){
    5. std::cerr<<"The system has no opengl suppport"<<std::endl;
    6. return 1;
    7. }
    8.  
    9. DrawTriangulation *drawtriangulation = new DrawTriangulation(test_data);
    10. drawtriangulation->show();
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. class DrawTriangulation : public QGLWidget {
    2. Q_OBJECT
    3.  
    4. private:
    5.  
    6. vector <Point_2D> *mTestData;
    7. vector <Point_2D>::iterator mTestDataItr;
    8. vector <Line *> *mLines;
    9.  
    10. protected:
    11. void PrintLines(bool Mode);
    12. void initializeGL();
    13. void resizeGL(int w, int h);
    14. void paintGL();
    15.  
    16. public:
    17.  
    18. DrawTriangulation(vector <Point_2D> *TestData, QWidget *parent=NULL);
    19.  
    20. };
    To copy to clipboard, switch view to plain text mode 

    The "Point_2D" is a tested class which is working.

    The constructor is as :

    Qt Code:
    1. DrawTriangulation::DrawTriangulation(vector <Point_2D> *TestData, QWidget *parent) : QGLWidget(parent) {
    2.  
    3. mTestData = new vector <Point_2D >;
    4. mLines = new vector<Line *>;
    5.  
    6. cout<<"hello world ... in const";
    7.  
    8. mTestData->assign(TestData->begin(), TestData->end());
    9. setFormat(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer));
    10. };
    To copy to clipboard, switch view to plain text mode 

    The debugging error is giving in the last line of "qglobal.h". The code stops running and points to ...

    Qt Code:
    1. template<typename Enum>
    2. class QFlags
    3. {
    4. typedef void **Zero;
    5. int i;
    6. public:
    7. typedef Enum enum_type;
    8. inline QFlags(const QFlags &f) : i(f.i) {}
    9. inline QFlags(Enum f) : i(f) {}
    10. inline QFlags(Zero = 0) : i(0) {}
    To copy to clipboard, switch view to plain text mode 

    Please help ....

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt Open Gl Programming in Netbeans IDE

    Please post the full backtrace.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Netbeans IDE - Debugging Qt apps
    By johnnyturbo3 in forum Newbie
    Replies: 1
    Last Post: 27th January 2011, 14:49
  2. Netbeans IDE
    By Petr_Kropotkin in forum General Discussion
    Replies: 0
    Last Post: 11th October 2010, 18:08
  3. Replies: 0
    Last Post: 30th June 2010, 15:12
  4. Replies: 1
    Last Post: 22nd November 2009, 11:23
  5. qt4.x in netbeans 6.5
    By siddharth_univ in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2008, 03:16

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
  •  
Qt is a trademark of The Qt Company.