111 { QColor (80, 192, 0), Vertex (0, 10000, 0) }, // Y |
111 { QColor (80, 192, 0), Vertex (0, 10000, 0) }, // Y |
112 { QColor (0, 160, 192), Vertex (0, 0, 10000) }, // Z |
112 { QColor (0, 160, 192), Vertex (0, 0, 10000) }, // Z |
113 }; |
113 }; |
114 |
114 |
115 static GLuint g_GLAxes_VBO; |
115 static GLuint g_GLAxes_VBO; |
|
116 static GLuint g_GLAxes_ColorVBO; |
116 |
117 |
117 // ============================================================================= |
118 // ============================================================================= |
118 // |
119 // |
119 GLRenderer::GLRenderer (QWidget* parent) : QGLWidget (parent) |
120 GLRenderer::GLRenderer (QWidget* parent) : QGLWidget (parent) |
120 { |
121 { |
265 // ============================================================================= |
266 // ============================================================================= |
266 // |
267 // |
267 void GLRenderer::initializeAxes() |
268 void GLRenderer::initializeAxes() |
268 { |
269 { |
269 float axesdata[18]; |
270 float axesdata[18]; |
|
271 float colordata[18]; |
270 memset (axesdata, 0, sizeof axesdata); |
272 memset (axesdata, 0, sizeof axesdata); |
271 float colordata[18]; |
|
272 |
273 |
273 for (int i = 0; i < 3; ++i) |
274 for (int i = 0; i < 3; ++i) |
274 { |
275 { |
275 for (int j = 0; j < 3; ++j) |
276 for (int j = 0; j < 3; ++j) |
276 { |
277 { |
287 } |
288 } |
288 |
289 |
289 glGenBuffers (1, &g_GLAxes_VBO); |
290 glGenBuffers (1, &g_GLAxes_VBO); |
290 glBindBuffer (GL_ARRAY_BUFFER, g_GLAxes_VBO); |
291 glBindBuffer (GL_ARRAY_BUFFER, g_GLAxes_VBO); |
291 glBufferData (GL_ARRAY_BUFFER, sizeof axesdata, axesdata, GL_STATIC_DRAW); |
292 glBufferData (GL_ARRAY_BUFFER, sizeof axesdata, axesdata, GL_STATIC_DRAW); |
|
293 glGenBuffers (1, &g_GLAxes_ColorVBO); |
|
294 glBindBuffer (GL_ARRAY_BUFFER, g_GLAxes_ColorVBO); |
|
295 glBufferData (GL_ARRAY_BUFFER, sizeof colordata, colordata, GL_STATIC_DRAW); |
292 glBindBuffer (GL_ARRAY_BUFFER, 0); |
296 glBindBuffer (GL_ARRAY_BUFFER, 0); |
293 } |
297 } |
294 |
298 |
295 // ============================================================================= |
299 // ============================================================================= |
296 // |
300 // |
408 glEnableClientState (GL_COLOR_ARRAY); |
412 glEnableClientState (GL_COLOR_ARRAY); |
409 |
413 |
410 if (gl_axes) |
414 if (gl_axes) |
411 { |
415 { |
412 glBindBuffer (GL_ARRAY_BUFFER, g_GLAxes_VBO); |
416 glBindBuffer (GL_ARRAY_BUFFER, g_GLAxes_VBO); |
413 checkGLError(); |
|
414 glVertexPointer (3, GL_FLOAT, 0, NULL); |
417 glVertexPointer (3, GL_FLOAT, 0, NULL); |
415 checkGLError(); |
418 glBindBuffer (GL_ARRAY_BUFFER, g_GLAxes_VBO); |
|
419 glColorPointer (3, GL_FLOAT, 0, NULL); |
416 glDrawArrays (GL_LINES, 0, 6); |
420 glDrawArrays (GL_LINES, 0, 6); |
417 checkGLError(); |
421 checkGLError(); |
418 } |
422 } |
419 |
423 |
420 if (isPicking()) |
424 if (isPicking()) |