src/gl/partrenderer.cpp

changeset 51
1a9eac27698d
parent 48
3c10f0e2fbe0
child 53
3af627f7a40f
--- a/src/gl/partrenderer.cpp	Fri Feb 07 02:02:16 2020 +0200
+++ b/src/gl/partrenderer.cpp	Fri Feb 07 23:59:06 2020 +0200
@@ -115,15 +115,16 @@
 			static_cast<float>(backgroundColor.greenF()),
 			static_cast<float>(backgroundColor.blueF()),
 			1.0f);
-		this->compiler->setUniform("useLighting", true);
+		this->compiler->setUniform("useLighting", GL_TRUE);
 	}
 	else
 	{
 		glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
-		this->compiler->setUniform("useLighting", false);
+		this->compiler->setUniform("useLighting", GL_FALSE);
 	}
 	this->compiler->setUniform("selectedColor", vec3FromQColor(this->renderPreferences.selectedColor));
 	this->compiler->setUniform("highlighted", this->highlighted.value);
+	this->checkForGLErrors();
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 	glEnable(GL_DEPTH_TEST);
 	glEnable(GL_POLYGON_OFFSET_FILL);
@@ -187,7 +188,9 @@
 {
 	this->compiler->bindVertexArray(arrayClass);
 	const std::size_t vertexCount = this->compiler->vertexCount(arrayClass);
+	this->checkForGLErrors();
 	glDrawArrays(getGlTypeForArrayClass(arrayClass), 0, static_cast<GLsizei>(vertexCount));
+	this->checkForGLErrors();
 	this->compiler->releaseVertexArray(arrayClass);
 	this->checkForGLErrors();
 }
@@ -250,7 +253,9 @@
 	this->makeCurrent();
 	this->renderScene();
 	std::array<GLbyte, 3> data;
+	this->checkForGLErrors();
 	glReadPixels(where.x(), this->height() - where.y(), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &data[0]);
+	this->checkForGLErrors();
 	this->renderPreferences.style = oldRenderStyle;
 	this->update();
 	return gl::Compiler::idFromColor(data);
@@ -280,9 +285,3 @@
 	}
 	this->update();
 }
-
-void PartRenderer::setHighlight(ldraw::Id highlightedId)
-{
-	this->highlighted = highlightedId;
-}
-

mercurial