fixed signed vs unsigned nonsense in gl::Compiler::idFromColor

Wed, 11 Mar 2020 17:19:28 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 11 Mar 2020 17:19:28 +0200
changeset 78
97c3ce5aa498
parent 77
028798a72591
child 79
5fe2dd4e161a

fixed signed vs unsigned nonsense in gl::Compiler::idFromColor

src/gl/compiler.cpp file | annotate | diff | comparison | revisions
src/gl/compiler.h file | annotate | diff | comparison | revisions
src/gl/partrenderer.cpp file | annotate | diff | comparison | revisions
--- a/src/gl/compiler.cpp	Mon Mar 09 23:42:26 2020 +0200
+++ b/src/gl/compiler.cpp	Wed Mar 11 17:19:28 2020 +0200
@@ -237,7 +237,7 @@
 	return gl::ArrayClass::Lines;
 }
 
-ldraw::id_t gl::Compiler::idFromColor(const std::array<GLbyte, 3>& data)
+ldraw::id_t gl::Compiler::idFromColor(const std::array<GLubyte, 3>& data)
 {
 	return {data[0] * std::int32_t{0x10000} + data[1] * std::int32_t{0x100} + data[2]};
 }
--- a/src/gl/compiler.h	Mon Mar 09 23:42:26 2020 +0200
+++ b/src/gl/compiler.h	Wed Mar 11 17:19:28 2020 +0200
@@ -63,7 +63,7 @@
 	void buildShaders(int arrayId);
 	void setSelectedObjects(const QSet<ldraw::id_t> ids);
 
-	static ldraw::id_t idFromColor(const std::array<GLbyte, 3>& data);
+	static ldraw::id_t idFromColor(const std::array<GLubyte, 3>& data);
 
 	template<typename T>
 	void setUniform(const char* uniformName, T&& value)
--- a/src/gl/partrenderer.cpp	Mon Mar 09 23:42:26 2020 +0200
+++ b/src/gl/partrenderer.cpp	Wed Mar 11 17:19:28 2020 +0200
@@ -341,7 +341,7 @@
 	this->renderPreferences.style = gl::RenderStyle::PickScene;
 	this->makeCurrent();
 	this->renderScene();
-	std::array<GLbyte, 3> data;
+	std::array<GLubyte, 3> data;
 	this->checkForGLErrors();
 	glReadPixels(where.x(), this->height() - where.y(), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &data[0]);
 	this->checkForGLErrors();

mercurial