Skip to content
This repository was archived by the owner on May 16, 2020. It is now read-only.

Raspberry Pi support #373

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve formatting.
  • Loading branch information
techyian committed Jun 23, 2019
commit 63c1fb9c17cf30a7e85216614d84b9af97b43258
38 changes: 28 additions & 10 deletions src/renderer/tr_backend.c
Original file line number Diff line number Diff line change
@@ -909,30 +909,48 @@ void RE_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *d
qglColor3f(tr.identityLight, tr.identityLight, tr.identityLight);

#ifdef FEATURE_RENDERER_GLES
GLfloat tex[] = {
0.5f / cols, 0.5f / rows,
( cols - 0.5f ) / cols , 0.5f / rows,
( cols - 0.5f ) / cols, ( rows - 0.5f ) / rows,
0.5f / cols, ( rows - 0.5f ) / rows };
GLfloat vtx[] = {
x, y,
x+w, y,
x+w, y+h,
x, y+h };
GLfloat tex[] =
{
0.5f / cols, 0.5f / rows,
( cols - 0.5f ) / cols , 0.5f / rows,
( cols - 0.5f ) / cols, ( rows - 0.5f ) / rows,
0.5f / cols, ( rows - 0.5f ) / rows
};
GLfloat vtx[] =
{
x, y,
x + w, y,
x + w, y + h,
x, y + h
};
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);

if (glcol)
{
qglDisableClientState(GL_COLOR_ARRAY);
}

if (!text)
{
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
}

qglEnableClientState(GL_VERTEX_ARRAY);
qglTexCoordPointer( 2, GL_FLOAT, 0, tex );
qglVertexPointer ( 2, GL_FLOAT, 0, vtx );
qglDrawArrays( GL_TRIANGLE_FAN, 0, 4 );

if (!text)
{
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
}

if (glcol)
{
qglEnableClientState(GL_COLOR_ARRAY);
}

#else
qglBegin(GL_QUADS);
qglTexCoord2f(0.5f / cols, 0.5f / rows);
2 changes: 1 addition & 1 deletion src/renderer/tr_main.c
Original file line number Diff line number Diff line change
@@ -1781,7 +1781,7 @@ void R_DebugPolygon(int color, int numPoints, float *points)

// draw solid shade
#ifdef FEATURE_RENDERER_GLES
qglColor4f( color&1, (color>>1)&1, (color>>2)&1, 1.0f );
qglColor4f( color & 1, (color >> 1) & 1, (color >> 2) & 1, 1.0f );
qglVertexPointer ( 3, GL_FLOAT, 0, points );
qglDrawArrays( GL_TRIANGLE_FAN, 0, numPoints );
#else
2 changes: 1 addition & 1 deletion src/renderer/tr_shadows.c
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ static int numEdgeDefs[SHADER_MAX_VERTEXES];
static int facing[SHADER_MAX_INDEXES / 3];

#ifdef FEATURE_RENDERER_GLES
static unsigned short indexes[6*MAX_EDGE_DEFS*SHADER_MAX_VERTEXES];
static unsigned short indexes[6 * MAX_EDGE_DEFS * SHADER_MAX_VERTEXES];
static int idx = 0;
#endif

42 changes: 26 additions & 16 deletions src/renderer/tr_sky.c
Original file line number Diff line number Diff line change
@@ -442,16 +442,21 @@ static void DrawSkySide(struct image_s *image, const int mins[2], const int maxs
GL_Bind(image);

#ifdef FEATURE_RENDERER_GLES
GLfloat vtx[3*1024]; // arbitrary sized
GLfloat tex[2*1024];
GLfloat vtx[3 * 1024]; // arbitrary sized
GLfloat tex[2 * 1024];
int idx;

GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
if (glcol)
qglDisableClientState(GL_COLOR_ARRAY);
{
qglDisableClientState(GL_COLOR_ARRAY);
}

if (!text)
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
{
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
}
#endif

for (t = mins[1] + HALF_SKY_SUBDIVISIONS; t < maxs[1] + HALF_SKY_SUBDIVISIONS; t++)
@@ -465,11 +470,11 @@ static void DrawSkySide(struct image_s *image, const int mins[2], const int maxs
for (s = mins[0] + HALF_SKY_SUBDIVISIONS; s <= maxs[0] + HALF_SKY_SUBDIVISIONS; s++)
{
#ifdef FEATURE_RENDERER_GLES
memcpy(tex+idx*2, s_skyTexCoords[t][s], sizeof(GLfloat)*2);
memcpy(vtx+idx*3, s_skyPoints[t][s], sizeof(GLfloat)*3);
memcpy(tex + idx * 2, s_skyTexCoords[t][s], sizeof(GLfloat) * 2);
memcpy(vtx + idx * 3, s_skyPoints[t][s], sizeof(GLfloat) * 3);
idx++;
memcpy(tex+idx*2, s_skyTexCoords[t+1][s], sizeof(GLfloat)*2);
memcpy(vtx+idx*3, s_skyPoints[t+1][s], sizeof(GLfloat)*3);
memcpy(tex + idx * 2, s_skyTexCoords[t+1][s], sizeof(GLfloat) * 2);
memcpy(vtx + idx * 3, s_skyPoints[t+1][s], sizeof(GLfloat) * 3);
idx++;
#else
qglTexCoord2fv(s_skyTexCoords[t][s]);
@@ -511,16 +516,21 @@ static void DrawSkySideInner(struct image_s *image, const int mins[2], const int
GL_Bind(image);

#ifdef FEATURE_RENDERER_GLES
GLfloat vtx[3*1024]; // arbitrary sized
GLfloat tex[2*1024];
GLfloat vtx[3 * 1024]; // arbitrary sized
GLfloat tex[2 * 1024];
int idx;

GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
if (glcol)
qglDisableClientState(GL_COLOR_ARRAY);
{
qglDisableClientState(GL_COLOR_ARRAY);
}

if (!text)
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
{
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
}
#endif

//qglDisable (GL_BLEND);
@@ -539,11 +549,11 @@ static void DrawSkySideInner(struct image_s *image, const int mins[2], const int
for (s = mins[0] + HALF_SKY_SUBDIVISIONS; s <= maxs[0] + HALF_SKY_SUBDIVISIONS; s++)
{
#ifdef FEATURE_RENDERER_GLES
memcpy(tex+idx*2, s_skyTexCoords[t][s], sizeof(GLfloat)*2);
memcpy(vtx+idx*3, s_skyPoints[t][s], sizeof(GLfloat)*3);
memcpy(tex + idx * 2, s_skyTexCoords[t][s], sizeof(GLfloat) * 2);
memcpy(vtx + idx * 3, s_skyPoints[t][s], sizeof(GLfloat) * 3);
idx++;
memcpy(tex+idx*2, s_skyTexCoords[t+1][s], sizeof(GLfloat)*2);
memcpy(vtx+idx*3, s_skyPoints[t+1][s], sizeof(GLfloat)*3);
memcpy(tex + idx * 2, s_skyTexCoords[t+1][s], sizeof(GLfloat) * 2);
memcpy(vtx + idx * 3, s_skyPoints[t+1][s], sizeof(GLfloat) * 3);
idx++;
#else
qglTexCoord2fv(s_skyTexCoords[t][s]);
45 changes: 29 additions & 16 deletions src/renderer/tr_surface.c
Original file line number Diff line number Diff line change
@@ -1755,34 +1755,47 @@ void RB_SurfaceAxis(void)

#ifdef FEATURE_RENDERER_GLES
GLfloat col[] = {
1,0,0, 1,
1,0,0, 1,
0,1,0, 1,
0,1,0, 1,
0,0,1, 1,
0,0,1, 1
1, 0, 0, 1,
1, 0, 0, 1,
0, 1, 0, 1,
0, 1, 0, 1,
0, 0, 1, 1,
0, 0, 1, 1
};
GLfloat vtx[] = {
0,0,0,
16,0,0,
0,0,0,
0,16,0,
0,0,0,
0,0,16
0, 0, 0,
16, 0, 0,
0, 0, 0,
0, 16, 0,
0, 0, 0,
0, 0, 16
};
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);

if (text)
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
{
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
}

if (!glcol)
qglEnableClientState( GL_COLOR_ARRAY);
{
qglEnableClientState( GL_COLOR_ARRAY);
}

qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, col );
qglVertexPointer (3, GL_FLOAT, 0, vtx);
qglDrawArrays(GL_LINES, 0, 6);

if (text)
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
{
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
}

if (!glcol)
qglDisableClientState( GL_COLOR_ARRAY);
{
qglDisableClientState( GL_COLOR_ARRAY);
}
#else
qglBegin(GL_LINES);
qglColor3f(1, 0, 0);