shithub: cstory

Download patch

ref: 9cc1a5a0989d9cfe242fde830077bb45a748d75c
parent: 64f7a2eae3fbe666241211487e22196fa5485100
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Jul 30 22:55:22 EDT 2019

Change colour_buffer to unsigned bytes instead of floats

--- a/src/Backends/Rendering/OpenGL2.cpp
+++ b/src/Backends/Rendering/OpenGL2.cpp
@@ -31,7 +31,7 @@
 static GLuint framebuffer_id;
 static GLfloat vertex_buffer[4][2];
 static GLfloat texture_coordinate_buffer[4][2];
-static GLfloat colour_buffer[4][3];
+static GLubyte colour_buffer[4][3];
 
 static Backend_Surface framebuffer_surface;
 
@@ -122,7 +122,7 @@
 	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 	glVertexPointer(2, GL_FLOAT, 0, vertex_buffer);
 	glTexCoordPointer(2, GL_FLOAT, 0, texture_coordinate_buffer);
-	glColorPointer(3, GL_FLOAT, 0, colour_buffer);
+	glColorPointer(3, GL_UNSIGNED_BYTE, 0, colour_buffer);
 
 	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
 	glClear(GL_COLOR_BUFFER_BIT);
@@ -181,9 +181,9 @@
 
 	glBindTexture(GL_TEXTURE_2D, framebuffer_surface.texture_id);
 
-	colour_buffer[0][0] = 1.0f;
-	colour_buffer[0][1] = 1.0f;
-	colour_buffer[0][2] = 1.0f;
+	colour_buffer[0][0] = 0xFF;
+	colour_buffer[0][1] = 0xFF;
+	colour_buffer[0][2] = 0xFF;
 	colour_buffer[1][0] = colour_buffer[0][0];
 	colour_buffer[1][1] = colour_buffer[0][1];
 	colour_buffer[1][2] = colour_buffer[0][2];
@@ -294,9 +294,9 @@
 	const GLfloat vertex_top = (GLfloat)y;
 	const GLfloat vertex_bottom = (GLfloat)y + (rect->bottom - rect->top);
 
-	colour_buffer[0][0] = 1.0f;
-	colour_buffer[0][1] = 1.0f;
-	colour_buffer[0][2] = 1.0f;
+	colour_buffer[0][0] = 0xFF;
+	colour_buffer[0][1] = 0xFF;
+	colour_buffer[0][2] = 0xFF;
 	colour_buffer[1][0] = colour_buffer[0][0];
 	colour_buffer[1][1] = colour_buffer[0][1];
 	colour_buffer[1][2] = colour_buffer[0][2];
@@ -361,9 +361,9 @@
 	// Use blank default texture, for a solid colour-fill
 	glBindTexture(GL_TEXTURE_2D, 0);
 
-	colour_buffer[0][0] = red / 255.0f;
-	colour_buffer[0][1] = green / 255.0f;
-	colour_buffer[0][2] = blue / 255.0f;
+	colour_buffer[0][0] = red;
+	colour_buffer[0][1] = green;
+	colour_buffer[0][2] = blue;
 	colour_buffer[1][0] = colour_buffer[0][0];
 	colour_buffer[1][1] = colour_buffer[0][1];
 	colour_buffer[1][2] = colour_buffer[0][2];
@@ -508,9 +508,9 @@
 	const GLfloat vertex_top = (GLfloat)y;
 	const GLfloat vertex_bottom = (GLfloat)y + glyph->height;
 
-	colour_buffer[0][0] = colours[0] / 255.0f;
-	colour_buffer[0][1] = colours[1] / 255.0f;
-	colour_buffer[0][2] = colours[2] / 255.0f;
+	colour_buffer[0][0] = colours[0];
+	colour_buffer[0][1] = colours[1];
+	colour_buffer[0][2] = colours[2];
 	colour_buffer[1][0] = colour_buffer[0][0];
 	colour_buffer[1][1] = colour_buffer[0][1];
 	colour_buffer[1][2] = colour_buffer[0][2];