diff --git a/src/render/opengl/OpenGLRenderer.cpp b/src/render/opengl/OpenGLRenderer.cpp index 5a5d0f1..e86ef48 100644 --- a/src/render/opengl/OpenGLRenderer.cpp +++ b/src/render/opengl/OpenGLRenderer.cpp @@ -6,6 +6,11 @@ #include "OpenGLSkybox.h" #include "OpenGLWater.h" #include "OpenGLTerrain.h" +#include "Scenery.h" +#include "LightingManager.h" +#include "Logs.h" + +#include "GL/glu.h" // TEMP OpenGLRenderer::OpenGLRenderer(Scenery* scenery): SoftwareRenderer(scenery) @@ -62,6 +67,7 @@ void OpenGLRenderer::initialize() prepare(); disableClouds(); + getLightingManager()->setSpecularity(false); skybox->initialize(); skybox->updateScenery(); @@ -71,6 +77,12 @@ void OpenGLRenderer::initialize() terrain->initialize(); terrain->updateScenery(); + + cameraChangeEvent(getScenery()->getCamera()); + } + else + { + logError("Failed to initialize OpenGL bindings"); } } @@ -80,6 +92,10 @@ void OpenGLRenderer::resize(int width, int height) { functions->glViewport(0, 0, width, height); } + getScenery()->getCamera()->setRenderSize(width, height); + render_camera->setRenderSize(width, height); + + cameraChangeEvent(getScenery()->getCamera()); } void OpenGLRenderer::paint() @@ -95,6 +111,12 @@ void OpenGLRenderer::paint() skybox->render(); terrain->render(); water->render(); + + int error_code; + while ((error_code = glGetError()) != GL_NO_ERROR) + { + logWarning("[OpenGL] ERROR : %s", (const char*)gluErrorString(error_code)); + } } } diff --git a/src/render/opengl/WidgetExplorer.cpp b/src/render/opengl/WidgetExplorer.cpp index 00e191d..0569964 100644 --- a/src/render/opengl/WidgetExplorer.cpp +++ b/src/render/opengl/WidgetExplorer.cpp @@ -28,10 +28,6 @@ QGLWidget(parent) camera->copy(_current_camera); _renderer = new OpenGLRenderer(scenery); - _renderer->prepare(); - _renderer->render_quality = 3; - _renderer->getLightingManager()->setSpecularity(false); - _renderer->disableClouds(); _average_frame_time = 0.05; _quality = 3; @@ -205,7 +201,6 @@ void WidgetExplorer::resizeGL(int w, int h) void WidgetExplorer::paintGL() { - GLenum error_code; QTime start_time; double frame_time; @@ -241,9 +236,4 @@ void WidgetExplorer::paintGL() glColor3f(1.0, 1.0, 1.0); renderText(5, height() - 9, tr("Please wait while loading scene...")); }*/ - - while ((error_code = glGetError()) != GL_NO_ERROR) - { - qDebug("[OpenGL] ERROR : %s", (const char*)gluErrorString(error_code)); - } } diff --git a/src/render/opengl/opengl.pro b/src/render/opengl/opengl.pro index 889cb72..e08d5a8 100644 --- a/src/render/opengl/opengl.pro +++ b/src/render/opengl/opengl.pro @@ -13,6 +13,8 @@ DEFINES += OPENGL_LIBRARY include(../../common.pri) +unix:LIBS += -lGLU + SOURCES += \ OpenGLRenderer.cpp \ ExplorerChunkTerrain.cpp \