Commit b41176d4 authored by Thomaas Herault's avatar Thomaas Herault
Browse files

Fix two issues:

 - First, Render_opengl inherits from Hook_event, thus Render_opengl should not re-declare members of Hook_event that are already protected, like _core.
 - Second, force Core to wait until the QT engine has initialized the Open GL windows before loading the files. Do this the quick and dirty way by inserting an event loop in the middle of the LAUNCH_INTERFACE case of Core, until initializeGL() has been called.
parent 650afac7
......@@ -846,6 +846,8 @@ void Core::launch_action(int state, void* arg) {
case _STATE_LAUNCH_GRAPHICAL_INTERFACE :
waitGUIInit = new QEventLoop(this);
_main_window = new Interface_graphic (this);/* launch the window interface */
Message::set_interface (_main_window);/* define which interface will receive messages */
......@@ -888,6 +890,9 @@ void Core::launch_action(int state, void* arg) {
_main_window->bind_render_area((QGLWidget*)_render_opengl);
/* Wait that the open gl renderer calls waitGUIInit->quit() to load the file */
waitGUIInit->exec();
if ( _STATE_OPEN_FILE == state ){
_main_window->opening_file(_file_opened);/* Must be called after binding the render area to the main window */
if( false == draw_trace(_file_opened, _DRAW_OPENGL) ){
......
......@@ -247,6 +247,8 @@ public:
*/
void launch_action(int state, void* arg = NULL);
QEventLoop *waitGUIInit;
protected:
......@@ -296,7 +298,7 @@ protected:
Render_opengl* _render_opengl;
#endif
void* _render;
void* _render;
//Render<Render_opengl>* _render_opengl;
......
......@@ -112,7 +112,7 @@ void Hook_event::updateRender(){
**********************************/
Hook_event::Hook_event(Render_opengl* render_instance, Core* core, QWidget *parent, const QGLFormat& format)
: QGLWidget(format, parent){
: QGLWidget(format, parent), _core(core) {
// GLenum glew_code;
......@@ -141,8 +141,6 @@ Hook_event::Hook_event(Render_opengl* render_instance, Core* core, QWidget *pare
_render_instance = render_instance;
_core = core;
_state = DRAWING_STATE_WAITING;/* At the beginning, no trace is drawing */
......
......@@ -67,6 +67,7 @@
#include "render/Render_opengl.hpp"
#include "render/Render.hpp"
/* -- */
#include "core/Core.hpp"
using namespace std;
......@@ -180,7 +181,7 @@ void Render_opengl::initializeGL() {
glClearStencil(0);
_wait_list = draw_wait();
_core->waitGUIInit->quit();
}
void Render_opengl::resizeGL(int width, int height) {
......
......@@ -140,11 +140,6 @@ class Render_opengl : /*public QGLWidget,*/ public Hook_event, public Render_te
protected:
/*!
* \brief Contains the parent instance.
*/
Core* _core;
/*!
* \brief The waiting screen display list.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment