So I'm using QT and basically making a full size OpenGL widget.
I'm getting this weird ass error when I right click or expand the screen (I think it's happening when it has to redraw). I don't believe this is an OpenGL or QT issue, or if it is I don't think it's a bug per-se, more-so something I'm missing..
For now I just got the framework finished using GLUT/OpenGL on Linux, but I'd like to get this version working as it promotes a lot more extensibility , IMO.
Header:
The lines in red is where it gets interesting. A QTime is just a class that contains a time value, it has a default c'tor.Code:#ifndefCONTENT_H #defineCONTENT_H #include<QGLWidget> #include<QTime> //classQTime; //classQTimer; classContent:publicQGLWidget { Q_OBJECT public: Content(QWidget*); ~Content(); protected: void initializeGL(); void resizeGL(int width, int height); void paintGL(); void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void wheelEvent(QWheelEvent *event); void keyPressEvent(QKeyEvent *event); void Paint(); private: void InitSceneSetup(); QTime start_time; //QTime curr_time; GLfloat x_location; //GLfloat waste; //float waste2; //double space_waster; GLfloat y_location; //QTime last_time; //QTimer refresh_timer; bool first_paint; bool scene_dirty; publicslots: void timeout(); }; #endif //CONTENT_H
If I COMMENT 'start_time', it will work flawlessly, as expected. If I uncomment it (note, it's not being referenced anywhere, simply uncommented), I get a crash upon right click, or if I expand the window the widget also doesn't resize (but doesn't crash until I right click).
If I UNCOMMENT 'start_time' AND I uncomment 'waste' - it ACTS AS IT SHOULD. Uncommenting 'waste2' makes it crash again.
These variables are NOT getting referenced anywhere, I can comment/uncomment them at will. Some makes it crash, some makes it run fine. I feel there's a memory alignment issue here...or some idiosyncrasy of C++ that I'm not thinking of/don't know about.
If I run it with the debugger, it WORKS FINE.
Any help is greatly appreciated. Thanks!
Versions:
- IDE = QT Creator v2.0.1
- QT = v4.7.0 (32 bit)
- qmake = v2.01a (qmake is the QT makefile generator)
- mingw32-make = v3.81 (i386-pc-mingw32)
- g++ (GCC) = v4.4.0
NOTE:
I am doing this for a school project. QT, C++, OpenGL are NOT target requirements of this course, the course is an animation techniques course, and is technology agnostic.
If you choose to take any work here (not sure why you would), I am EXPLICITLY NOT giving permission for it to be used in an academic setting without explicit acceptance from the professor. Feel free to take it for your own personal uses, though.