Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Modified OpenGL ES render driver to support new SDL_RenderFill, SDL_R…
Browse files Browse the repository at this point in the history
…enderLine, and SDL_RenderPoint.
  • Loading branch information
Holmes Futrell committed Jan 1, 2009
1 parent 76a03a1 commit 0764d24
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/video/SDL_glesfuncs.h
Expand Up @@ -86,7 +86,7 @@ SDL_PROC_UNUSED(void, glColor4x,
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,
Expand All @@ -110,7 +110,7 @@ SDL_PROC_UNUSED(void, glDepthFunc, (GLenum func))
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,
Expand Down
54 changes: 40 additions & 14 deletions src/video/SDL_renderer_gles.c
Expand Up @@ -632,11 +632,15 @@ GLES_RenderPoint(SDL_Renderer * renderer, int x, int y)
(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;
}

Expand All @@ -652,12 +656,17 @@ GLES_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
(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;
}

Expand All @@ -673,9 +682,26 @@ GLES_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect)
(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;
}

Expand Down

0 comments on commit 0764d24

Please sign in to comment.