Modified OpenGL ES render driver to support new SDL_RenderFill, SDL_RenderLine, and SDL_RenderPoint.
authorHolmes Futrell <hfutrell@umail.ucsb.edu>
Thu, 01 Jan 2009 23:47:33 +0000
changeset 29494eabc35fbb4a
parent 2948 31f207e27452
child 2950 04c9f1e4c496
Modified OpenGL ES render driver to support new SDL_RenderFill, SDL_RenderLine, and SDL_RenderPoint.
src/video/SDL_glesfuncs.h
src/video/SDL_renderer_gles.c
     1.1 --- a/src/video/SDL_glesfuncs.h	Thu Jan 01 23:01:05 2009 +0000
     1.2 +++ b/src/video/SDL_glesfuncs.h	Thu Jan 01 23:47:33 2009 +0000
     1.3 @@ -86,7 +86,7 @@
     1.4  SDL_PROC_UNUSED(void, glColorMask,
     1.5                  (GLboolean red, GLboolean green, GLboolean blue,
     1.6                   GLboolean alpha))
     1.7 -SDL_PROC_UNUSED(void, glColorPointer,
     1.8 +SDL_PROC(void, glColorPointer,
     1.9                  (GLint size, GLenum type, GLsizei stride,
    1.10                   const GLvoid * pointer))
    1.11  SDL_PROC_UNUSED(void, glCompressedTexImage2D,
    1.12 @@ -110,7 +110,7 @@
    1.13  SDL_PROC_UNUSED(void, glDepthMask, (GLboolean flag))
    1.14  SDL_PROC_UNUSED(void, glDepthRangex, (GLclampx zNear, GLclampx zFar))
    1.15  SDL_PROC(void, glDisable, (GLenum cap))
    1.16 -SDL_PROC_UNUSED(void, glDisableClientState, (GLenum array))
    1.17 +SDL_PROC(void, glDisableClientState, (GLenum array))
    1.18  SDL_PROC(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count))
    1.19  SDL_PROC_UNUSED(void, glDrawElements,
    1.20                  (GLenum mode, GLsizei count, GLenum type,
     2.1 --- a/src/video/SDL_renderer_gles.c	Thu Jan 01 23:01:05 2009 +0000
     2.2 +++ b/src/video/SDL_renderer_gles.c	Thu Jan 01 23:47:33 2009 +0000
     2.3 @@ -632,11 +632,15 @@
     2.4                      (GLfloat) renderer->b * inv255f,
     2.5                      (GLfloat) renderer->a * inv255f);
     2.6  
     2.7 -/* FIXME:
     2.8 -    data->glBegin(GL_POINTS);
     2.9 -    data->glVertex2i(x, y);
    2.10 -    data->glEnd();
    2.11 -*/
    2.12 +	GLshort vertices[2];
    2.13 +	vertices[0] = x;
    2.14 +	vertices[1] = y;
    2.15 +	
    2.16 +	data->glVertexPointer(2, GL_SHORT, 0, vertices);
    2.17 +	data->glEnableClientState(GL_VERTEX_ARRAY);
    2.18 +	data->glDrawArrays(GL_POINTS, 0, 1);
    2.19 +	data->glDisableClientState(GL_VERTEX_ARRAY);
    2.20 +	
    2.21      return 0;
    2.22  }
    2.23  
    2.24 @@ -652,12 +656,17 @@
    2.25                      (GLfloat) renderer->b * inv255f,
    2.26                      (GLfloat) renderer->a * inv255f);
    2.27  
    2.28 -/* FIXME:
    2.29 -    data->glBegin(GL_LINES);
    2.30 -    data->glVertex2i(x1, y1);
    2.31 -    data->glVertex2i(x2, y2);
    2.32 -    data->glEnd();
    2.33 -*/
    2.34 +	GLshort vertices[4];
    2.35 +	vertices[0] = x1;
    2.36 +	vertices[1] = y1;
    2.37 +	vertices[2] = x2;
    2.38 +	vertices[3] = y2;
    2.39 +
    2.40 +	data->glVertexPointer(2, GL_SHORT, 0, vertices);
    2.41 +	data->glEnableClientState(GL_VERTEX_ARRAY);
    2.42 +	data->glDrawArrays(GL_LINES, 0, 2);
    2.43 +	data->glDisableClientState(GL_VERTEX_ARRAY);
    2.44 +
    2.45      return 0;
    2.46  }
    2.47  
    2.48 @@ -673,9 +682,26 @@
    2.49                      (GLfloat) renderer->b * inv255f,
    2.50                      (GLfloat) renderer->a * inv255f);
    2.51  
    2.52 -/* FIXME:
    2.53 -    data->glRecti(rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
    2.54 -*/
    2.55 +	GLshort minx = rect->x;
    2.56 +	GLshort maxx = rect->x + rect->w;
    2.57 +	GLshort miny = rect->y;
    2.58 +	GLshort maxy = rect->y + rect->h;
    2.59 +	
    2.60 +	GLshort vertices[8];
    2.61 +	vertices[0] = minx;
    2.62 +	vertices[1] = miny;
    2.63 +	vertices[2] = maxx;
    2.64 +	vertices[3] = miny;
    2.65 +	vertices[4] = minx;
    2.66 +	vertices[5] = maxy;
    2.67 +	vertices[6] = maxx;
    2.68 +	vertices[7] = maxy;
    2.69 +	
    2.70 +	data->glVertexPointer(2, GL_SHORT, 0, vertices);
    2.71 +	data->glEnableClientState(GL_VERTEX_ARRAY);
    2.72 +	data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    2.73 +	data->glDisableClientState(GL_VERTEX_ARRAY);
    2.74 +
    2.75      return 0;
    2.76  }
    2.77