Permalink
Browse files

rendererGLES: first attempt to fix opengles, refs #1100

Opengl ES is very limited compared to desktop OpenGL implementation need
further investiagation.
  • Loading branch information...
rafal1137 committed Oct 5, 2018
1 parent 6ba4a35 commit afd0454e3c208a7a7f3b560fa5643a5ace029a54
@@ -341,14 +341,7 @@ void GL_State(unsigned long stateBits)
// fill/line mode
if (diff & GLS_POLYMODE_LINE)
{
if (stateBits & GLS_POLYMODE_LINE)
{
qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
else
{
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
qglPolygonMode(GL_FRONT_AND_BACK, GL_LINES);
}
// depthtest
@@ -849,8 +842,6 @@ void RE_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *d
start = ri.Milliseconds();
}
if (!GL_ARB_texture_non_power_of_two)
{
// make sure rows and cols are powers of 2
for (i = 0; (1 << i) < cols; i++)
{
@@ -862,7 +853,6 @@ void RE_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *d
{
Ren_Drop("Draw_StretchRaw: size not a power of 2: %i by %i", cols, rows);
}
}
GL_Bind(tr.scratchImage[client]);
@@ -1526,7 +1516,7 @@ const void *RB_SwapBuffers(const void *data)
unsigned char *stencilReadback;
stencilReadback = ri.Hunk_AllocateTempMemory(glConfig.vidWidth * glConfig.vidHeight);
qglReadPixels(0, 0, glConfig.vidWidth, glConfig.vidHeight, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, stencilReadback);
qglReadPixels(0, 0, glConfig.vidWidth, glConfig.vidHeight, GL_STENCIL_REF, GL_UNSIGNED_BYTE, stencilReadback);
for (i = 0; i < glConfig.vidWidth * glConfig.vidHeight; i++)
{
@@ -1565,7 +1555,7 @@ const void *RB_RenderToTexture(const void *data)
GL_Bind(cmd->image);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_LINEAR);
qglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
qglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_HINT, GL_TRUE);
qglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, cmd->x, cmd->y, cmd->w, cmd->h, 0);
//qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, cmd->x, cmd->y, cmd->w, cmd->h );
@@ -235,19 +235,7 @@ void R_ImageList_f(void)
case 4:
Ren_Print("RGBA ");
break;
case GL_RGBA8:
Ren_Print("RGBA8");
break;
case GL_RGB8:
Ren_Print("RGB8");
break;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
Ren_Print("DXT3 ");
break;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
Ren_Print("DXT5 ");
break;
case GL_RGB4_S3TC:
case GL_RGB8_OES:
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
Ren_Print("S3TC ");
break;
@@ -891,7 +879,7 @@ static void Upload32(unsigned *data,
if (textureFilterAnisotropic)
{
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
(GLint)Com_Clamp(1, maxAnisotropy, r_ext_max_anisotropy->integer));
(GLint)Com_Clamp(1, maxAnisotropy, r_extMaxAnisotropy->integer));
}
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
@@ -1314,7 +1302,7 @@ static void R_CreateFogImage(void)
borderColor[2] = 1.0;
borderColor[3] = 1;
qglTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
qglTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_ENV_COLOR, borderColor);
}
#define DEFAULT_SIZE 16
@@ -1493,7 +1481,7 @@ void R_SetColorMappings(void)
s_intensitytable[i] = j;
}
if (glConfig.deviceSupportsGamma && !GLEW_ARB_fragment_program)
if (glConfig.deviceSupportsGamma /*&& !GLEW_ARB_fragment_program */)
{
ri.GLimp_SetGamma(s_gammatable, s_gammatable, s_gammatable);
}
@@ -345,7 +345,7 @@ byte *RB_ReadZBuffer(int x, int y, int width, int height, int *padlen)
bufstart = PADP(( intptr_t ) buffer, packAlign);
qglDepthRange(0.0f, 1.0f);
qglReadPixels(x, y, width, height, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, bufstart);
qglReadPixels(x, y, width, height, GL_DEPTH_COMPONENT32_OES, GL_UNSIGNED_BYTE, bufstart);
*padlen = padwidth - linelen;
@@ -943,7 +943,7 @@ void GL_SetDefaultState(void)
// make sure our GL state vector is set correctly
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
qglPolygonMode(GL_FRONT_AND_BACK, GL_LINES);
qglDepthMask(GL_TRUE);
qglDisable(GL_DEPTH_TEST);
qglEnable(GL_SCISSOR_TEST);
@@ -1781,7 +1781,7 @@ void R_DebugPolygon(int color, int numPoints, float *points)
// draw solid shade
qglColor3f(color & 1, (color >> 1) & 1, (color >> 2) & 1);
qglBegin(GL_POLYGON);
qglBegin(GL_TRIANGLE_FAN);
for (i = 0 ; i < numPoints ; i++)
{
qglVertex3fv(points + i * 3);
@@ -1792,7 +1792,7 @@ void R_DebugPolygon(int color, int numPoints, float *points)
GL_State(GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
qglDepthRange(0, 0);
qglColor3f(1, 1, 1);
qglBegin(GL_POLYGON);
qglBegin(GL_TRIANGLE_FAN);
for (i = 0 ; i < numPoints ; i++)
{
qglVertex3fv(points + i * 3);
@@ -189,7 +189,7 @@ static void DrawTris(shaderCommands_t *input)
{
stateBits |= (GLS_POLYMODE_LINE);
GL_State(stateBits);
qglEnable(GL_POLYGON_OFFSET_LINE);
qglEnable(GL_POLYGON_OFFSET_FILL);
qglPolygonOffset(r_offsetFactor->value, r_offsetUnits->value);
}
@@ -212,7 +212,7 @@ static void DrawTris(shaderCommands_t *input)
Ren_LogComment("glUnlockArraysEXT\n");
}
qglDepthRange(0, 1);
qglDisable(GL_POLYGON_OFFSET_LINE);
qglDisable(GL_POLYGON_OFFSET_FILL);
}
/**
@@ -348,7 +348,7 @@ static void DrawMultitextured(shaderCommands_t *input, int stage)
// bug with multitexture and clip planes
if (backEnd.viewParms.isPortal)
{
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
qglPolygonMode(GL_FRONT_AND_BACK, GL_LINES);
}
// base

0 comments on commit afd0454

Please sign in to comment.