Permalink
Browse files

rendererGLES: added some OpenGL ES implementation, refs #1100

  • Loading branch information...
rafal1137 committed Oct 6, 2018
1 parent bfe77d6 commit fe41e0ee46b15bbac69a88ed6b0ac2f548adfa85
Showing with 31 additions and 19 deletions.
  1. +4 −13 src/rendererGLES/tr_main.c
  2. +25 −4 src/rendererGLES/tr_shadows.c
  3. +2 −2 src/rendererGLES/tr_sky.c
View
17 src/rendererGLES/tr_main.c 100644 → 100755
@@ -1781,23 +1781,14 @@ void R_DebugPolygon(int color, int numPoints, float *points)
// draw solid shade
qglColor3f(color & 1, (color >> 1) & 1, (color >> 2) & 1);
qglBegin(GL_TRIANGLE_FAN);
for (i = 0 ; i < numPoints ; i++)
{
qglVertex3fv(points + i * 3);
}
qglEnd();
qglVertexPointer(3, GL_FLOAT, 0, points);
qglDrawArrays(GL_TRIANGLE_FAN, 0, numPoints);
// draw wireframe outline
GL_State(GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
qglDepthRange(0, 0);
qglColor3f(1, 1, 1);
qglBegin(GL_TRIANGLE_FAN);
for (i = 0 ; i < numPoints ; i++)
{
qglVertex3fv(points + i * 3);
}
qglEnd();
qglVertexPointer(3, GL_FLOAT, 0, points);
qglDrawArrays(GL_LINES, 0, numPoints);
qglDepthRange(0, 1);
}
View
29 src/rendererGLES/tr_shadows.c 100644 → 100755
@@ -122,7 +122,7 @@ void R_RenderShadowEdges(void)
// triangle, it is a sil edge
if (hit[1] == 0)
{
// OpenGLES implementation
// OpenGLES implementation
// A single drawing call is better than many. So I prefer a singe TRIANGLES call than many TRAINGLE_STRIP call
// even if it seems less efficiant, it's faster on the PANDORA
indexes[idx++] = i;
@@ -234,6 +234,18 @@ void RB_ShadowTessEnd(void)
qglEnable(GL_STENCIL_TEST);
qglStencilFunc(GL_ALWAYS, 1, 255);
qglVertexPointer(3, GL_FLOAT, 16, tess.xyz);
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
if (text)
{
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
if (glcol)
{
qglDisableClientState(GL_COLOR_ARRAY);
}
// mirrors have the culling order reversed
if (backEnd.viewParms.isMirror)
{
@@ -245,7 +257,7 @@ void RB_ShadowTessEnd(void)
qglCullFace(GL_BACK);
qglStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
R_RenderShadowEdges();
qglDrawElements(GL_TRIANGLES, idx, GL_UNSIGNED_SHORT, indexes);
}
else
{
@@ -257,7 +269,16 @@ void RB_ShadowTessEnd(void)
qglCullFace(GL_FRONT);
qglStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
R_RenderShadowEdges();
qglDrawElements(GL_TRIANGLES, idx, GL_UNSIGNED_SHORT, indexes);
}
if (text)
{
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
if (glcol)
{
qglEnableClientState(GL_COLOR_ARRAY);
}
// reenable writing to the color buffer
@@ -294,7 +315,7 @@ void RB_ShadowFinish(void)
qglColor3f(0.6f, 0.6f, 0.6f);
GL_State(GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);
// OpenGLES implementation
// OpenGLES implementation
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
if (text)
View
4 src/rendererGLES/tr_sky.c 100644 → 100755
@@ -439,7 +439,7 @@ static void DrawSkySide(struct image_s *image, const int mins[2], const int maxs
{
int s, t;
// OpenGLES implementation
// OpenGLES implementation
GL_Bind(image);
GLfloat vtx[3 * 1024]; // arbitrary sized
GLfloat tex[2 * 1024];
@@ -486,7 +486,7 @@ static void DrawSkySideInner(struct image_s *image, const int mins[2], const int
{
int s, t;
// OpenGLES implementation
// OpenGLES implementation
GL_Bind(image);
GLfloat vtx[3 * 1024]; // arbitrary sized
GLfloat tex[2 * 1024];

0 comments on commit fe41e0e

Please sign in to comment.