comparison engine/core/video/opengl/renderbackendopengl.cpp @ 430:ad1f09d954f9

Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 23 Feb 2010 19:25:59 +0000
parents ad7969d9460b
children b2feacaed53c
comparison
equal deleted inserted replaced
429:be291458d9b5 430:ad1f09d954f9
198 glVertex3f(p2.x+0.5f, p2.y+0.5f, 0); 198 glVertex3f(p2.x+0.5f, p2.y+0.5f, 0);
199 glEnd(); 199 glEnd();
200 } 200 }
201 201
202 void RenderBackendOpenGL::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b) { 202 void RenderBackendOpenGL::drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b) {
203 glColor4ub(r, g, b, 165); 203 glColor4ub(r, g, b, 165);
204 glBegin(GL_QUADS); 204 glBegin(GL_QUADS);
205 glVertex3f(p1.x, p1.y, 0); 205 glVertex3f(p1.x, p1.y, 0);
206 glVertex3f(p2.x, p2.y, 0); 206 glVertex3f(p2.x, p2.y, 0);
207 glVertex3f(p3.x, p3.y, 0); 207 glVertex3f(p3.x, p3.y, 0);
208 glVertex3f(p4.x, p4.y, 0); 208 glVertex3f(p4.x, p4.y, 0);
209 glEnd(); 209 glEnd();
210 } 210 }
211 211
212 void RenderBackendOpenGL::drawVertex(const Point& p, const uint8_t size, int r, int g, int b){
213
214 GLfloat width;
215
216 glGetFloatv(GL_LINE_WIDTH, &width);
217 glLineWidth(1.0);
218
219 glBegin(GL_LINE_LOOP);
220 glColor4ub(r, g, b, 255);
221
222 glVertex3f(p.x-size, p.y+size, 0);
223 glVertex3f(p.x+size, p.y+size, 0);
224 glVertex3f(p.x+size, p.y-size, 0);
225 glVertex3f(p.x-size, p.y-size, 0);
226
227 glEnd();
228
229 glLineWidth(width);
230 }
212 } 231 }