src/gl/partrenderer.cpp

changeset 291
42b4953dff85
parent 290
0fd926ebb03b
child 309
d862721d19a3
--- a/src/gl/partrenderer.cpp	Tue Jun 28 17:35:56 2022 +0300
+++ b/src/gl/partrenderer.cpp	Tue Jun 28 17:59:34 2022 +0300
@@ -16,6 +16,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <GL/glew.h>
 #include <glm/ext/matrix_transform.hpp>
 #include <glm/ext/matrix_clip_space.hpp>
 #include <QOpenGLFramebufferObject>
@@ -29,17 +30,10 @@
 #include "src/settings.h"
 #include "src/gl/partrenderer.h"
 #include "src/gl/compiler.h"
-#include "src/gl/debug.h"
 
 static constexpr double MIN_ZOOM = -3.0;
 static constexpr double MAX_ZOOM = 3.0;
 
-QOpenGLFunctions& glfunc()
-{
-	static QOpenGLFunctions funcs;
-	return funcs;
-}
-
 PartRenderer::PartRenderer(
 	Model* model,
 	DocumentManager* documents,
@@ -56,9 +50,6 @@
 	QSurfaceFormat surfaceFormat;
 	surfaceFormat.setSamples(8);
 	this->setFormat(surfaceFormat);
-	connect(&this->logger, &QOpenGLDebugLogger::messageLogged, [&](const QOpenGLDebugMessage& glmessage){
-		Q_EMIT this->message(debugMessageToString(glmessage));
-	});
 	connect(model, &Model::rowsInserted, [&]{
 		this->needBuild = true;
 	});
@@ -81,18 +72,9 @@
 {
 }
 
-static QVector3D calcQVector3DFromQColor(const QColor& color)
-{
-	return {
-		float_cast(color.redF()),
-		float_cast(color.greenF()),
-		float_cast(color.blueF()),
-	};
-}
-
 void PartRenderer::initializeGL()
 {
-	glfunc().initializeOpenGLFunctions();
+	glewInit();
 	gl::initializeModelShaders(&this->shaders);
 	for (RenderLayer* layer : this->activeRenderLayers) {
 		layer->initializeGL();
@@ -100,10 +82,6 @@
 	for (RenderLayer* layer : this->inactiveRenderLayers) {
 		layer->initializeGL();
 	}
-	this->logger.initialize();
-	if (setting<Setting::LogOpenGLDebugMessages>()) {
-		this->logger.startLogging();
-	}
 	connect(this->model, &Model::dataChanged, this, &PartRenderer::build);
 	this->initialized = true;
 	this->modelQuaternion = glm::angleAxis(glm::radians(30.0f), glm::vec3{-1, 0, 0});
@@ -499,15 +477,6 @@
 	{
 		this->build();
 	}
-	if (this->initialized) {
-		this->makeCurrent();
-		if (setting<Setting::LogOpenGLDebugMessages>()) {
-			this->logger.startLogging();
-		}
-		else {
-			this->logger.stopLogging();
-		}
-	}
 	Q_EMIT this->renderPreferencesChanged();
 	this->update();
 }

mercurial