Mercurial > sdl-ios-xcode
diff src/video/SDL_renderer_gles.c @ 2949:4eabc35fbb4a
Modified OpenGL ES render driver to support new SDL_RenderFill, SDL_RenderLine, and SDL_RenderPoint.
author | Holmes Futrell <hfutrell@umail.ucsb.edu> |
---|---|
date | Thu, 01 Jan 2009 23:47:33 +0000 |
parents | 017d4334accf |
children | 0faae272a372 |
line wrap: on
line diff
--- a/src/video/SDL_renderer_gles.c Thu Jan 01 23:01:05 2009 +0000 +++ b/src/video/SDL_renderer_gles.c Thu Jan 01 23:47:33 2009 +0000 @@ -632,11 +632,15 @@ (GLfloat) renderer->b * inv255f, (GLfloat) renderer->a * inv255f); -/* FIXME: - data->glBegin(GL_POINTS); - data->glVertex2i(x, y); - data->glEnd(); -*/ + GLshort vertices[2]; + vertices[0] = x; + vertices[1] = y; + + data->glVertexPointer(2, GL_SHORT, 0, vertices); + data->glEnableClientState(GL_VERTEX_ARRAY); + data->glDrawArrays(GL_POINTS, 0, 1); + data->glDisableClientState(GL_VERTEX_ARRAY); + return 0; } @@ -652,12 +656,17 @@ (GLfloat) renderer->b * inv255f, (GLfloat) renderer->a * inv255f); -/* FIXME: - data->glBegin(GL_LINES); - data->glVertex2i(x1, y1); - data->glVertex2i(x2, y2); - data->glEnd(); -*/ + GLshort vertices[4]; + vertices[0] = x1; + vertices[1] = y1; + vertices[2] = x2; + vertices[3] = y2; + + data->glVertexPointer(2, GL_SHORT, 0, vertices); + data->glEnableClientState(GL_VERTEX_ARRAY); + data->glDrawArrays(GL_LINES, 0, 2); + data->glDisableClientState(GL_VERTEX_ARRAY); + return 0; } @@ -673,9 +682,26 @@ (GLfloat) renderer->b * inv255f, (GLfloat) renderer->a * inv255f); -/* FIXME: - data->glRecti(rect->x, rect->y, rect->x + rect->w, rect->y + rect->h); -*/ + GLshort minx = rect->x; + GLshort maxx = rect->x + rect->w; + GLshort miny = rect->y; + GLshort maxy = rect->y + rect->h; + + GLshort vertices[8]; + vertices[0] = minx; + vertices[1] = miny; + vertices[2] = maxx; + vertices[3] = miny; + vertices[4] = minx; + vertices[5] = maxy; + vertices[6] = maxx; + vertices[7] = maxy; + + data->glVertexPointer(2, GL_SHORT, 0, vertices); + data->glEnableClientState(GL_VERTEX_ARRAY); + data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + data->glDisableClientState(GL_VERTEX_ARRAY); + return 0; }