Mercurial > sdl-ios-xcode
changeset 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 | 31f207e27452 |
children | 04c9f1e4c496 |
files | src/video/SDL_glesfuncs.h src/video/SDL_renderer_gles.c |
diffstat | 2 files changed, 42 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/SDL_glesfuncs.h Thu Jan 01 23:01:05 2009 +0000 +++ b/src/video/SDL_glesfuncs.h Thu Jan 01 23:47:33 2009 +0000 @@ -86,7 +86,7 @@ SDL_PROC_UNUSED(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) -SDL_PROC_UNUSED(void, glColorPointer, +SDL_PROC(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)) SDL_PROC_UNUSED(void, glCompressedTexImage2D, @@ -110,7 +110,7 @@ SDL_PROC_UNUSED(void, glDepthMask, (GLboolean flag)) SDL_PROC_UNUSED(void, glDepthRangex, (GLclampx zNear, GLclampx zFar)) SDL_PROC(void, glDisable, (GLenum cap)) -SDL_PROC_UNUSED(void, glDisableClientState, (GLenum array)) +SDL_PROC(void, glDisableClientState, (GLenum array)) SDL_PROC(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count)) SDL_PROC_UNUSED(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type,
--- 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; }