- axes are now drawn properly again

Sun, 23 Feb 2014 20:13:32 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sun, 23 Feb 2014 20:13:32 +0200
changeset 687
77d7c22ec9f3
parent 686
9813d79d7ba5
child 688
2f4dcc323a85

- axes are now drawn properly again

src/GLRenderer.cc file | annotate | diff | comparison | revisions
--- a/src/GLRenderer.cc	Sun Feb 23 20:03:33 2014 +0200
+++ b/src/GLRenderer.cc	Sun Feb 23 20:13:32 2014 +0200
@@ -113,6 +113,7 @@
 };
 
 static GLuint g_GLAxes_VBO;
+static GLuint g_GLAxes_ColorVBO;
 
 // =============================================================================
 //
@@ -267,8 +268,8 @@
 void GLRenderer::initializeAxes()
 {
 	float axesdata[18];
+	float colordata[18];
 	memset (axesdata, 0, sizeof axesdata);
-	float colordata[18];
 
 	for (int i = 0; i < 3; ++i)
 	{
@@ -289,6 +290,9 @@
 	glGenBuffers (1, &g_GLAxes_VBO);
 	glBindBuffer (GL_ARRAY_BUFFER, g_GLAxes_VBO);
 	glBufferData (GL_ARRAY_BUFFER, sizeof axesdata, axesdata, GL_STATIC_DRAW);
+	glGenBuffers (1, &g_GLAxes_ColorVBO);
+	glBindBuffer (GL_ARRAY_BUFFER, g_GLAxes_ColorVBO);
+	glBufferData (GL_ARRAY_BUFFER, sizeof colordata, colordata, GL_STATIC_DRAW);
 	glBindBuffer (GL_ARRAY_BUFFER, 0);
 }
 
@@ -410,9 +414,9 @@
 	if (gl_axes)
 	{
 		glBindBuffer (GL_ARRAY_BUFFER, g_GLAxes_VBO);
-		checkGLError();
 		glVertexPointer (3, GL_FLOAT, 0, NULL);
-		checkGLError();
+		glBindBuffer (GL_ARRAY_BUFFER, g_GLAxes_VBO);
+		glColorPointer (3, GL_FLOAT, 0, NULL);
 		glDrawArrays (GL_LINES, 0, 6);
 		checkGLError();
 	}

mercurial