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 2 commits
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
70 changes: 46 additions & 24 deletions src/renderer/tr_backend.c
Original file line number Diff line number Diff line change
@@ -921,6 +921,7 @@ void RE_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *d
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 );
@@ -1342,9 +1343,9 @@ const void *RB_DrawBuffer(const void *data)
*/
void RB_GammaScreen(void)
{
#ifndef FEATURE_RENDERER_GLES
// We force the 2D drawing
RB_SetGL2D();
#ifndef FEATURE_RENDERER_GLES
R_ScreenGamma();
#endif
}
@@ -1373,6 +1374,19 @@ void RB_ShowImages(void)

start = ri.Milliseconds();

#ifdef FEATURE_RENDERER_GLES
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);
}
#endif

for (i = 0 ; i < tr.numImages ; i++)
{
image = tr.images[i];
@@ -1391,29 +1405,26 @@ void RB_ShowImages(void)
}

#ifdef FEATURE_RENDERER_GLES
GLfloat tex[] = {
0, 0,
1, 0,
1, 1,
0, 1 };
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 );
qglTexCoordPointer( 2, GL_FLOAT, 0, tex );
qglVertexPointer ( 2, GL_FLOAT, 0, vtx );
qglDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
if (glcol)
qglEnableClientState(GL_COLOR_ARRAY);
if (!text)
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
// OpenGLES Implementation
GLfloat tex[] =
{
0, 0,
1, 0,
1, 1,
0, 1
};
GLfloat vtx[] =
{
x, y,
x + w, y,
x + w, y + h,
x, y + h
};

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

#else
GL_Bind(image);
qglBegin(GL_QUADS);
@@ -1428,6 +1439,17 @@ void RB_ShowImages(void)
qglEnd();
#endif
}

#ifdef FEATURE_RENDERER_GLES
if (glcol)
{
qglEnableClientState(GL_COLOR_ARRAY);
}
if (!text)
{
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
#endif

qglFinish();

158 changes: 81 additions & 77 deletions src/renderer/tr_image.c
Original file line number Diff line number Diff line change
@@ -787,114 +787,118 @@ static void Upload32(unsigned *data,
}
}
// select proper internal format
#ifndef FEATURE_RENDERER_GLES
if (samples == 3)
{
if (r_greyScale->integer)
{
#ifdef FEATURE_RENDERER_GLES
internalFormat = GL_LUMINANCE;
#else
if (r_textureBits->integer == 16)
{
internalFormat = GL_LUMINANCE8;
}
else if (r_textureBits->integer == 32)
{
internalFormat = GL_LUMINANCE16;
}
else
{
internalFormat = GL_LUMINANCE;
}
#endif
if (r_textureBits->integer == 16)
{
internalFormat = GL_LUMINANCE8;
}
else if (r_textureBits->integer == 32)
{
internalFormat = GL_LUMINANCE16;
}
else
{
internalFormat = GL_LUMINANCE;
}
}
else
{
#ifdef FEATURE_RENDERER_GLES
if (r_textureBits->integer == 16)
if (!noCompress && glConfig.textureCompression == TC_S3TC_ARB)
{
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
}
else if (!noCompress && glConfig.textureCompression == TC_S3TC)
{
internalFormat = GL_RGB4_S3TC;
}
else if (r_textureBits->integer == 16)
{
internalFormat = GL_RGB5;
}
else if (r_textureBits->integer == 32)
{
internalFormat = GL_RGB8;
}
else
{
internalFormat = GL_RGB;
internalFormat = GL_RGB;
}
#else
if (!noCompress && glConfig.textureCompression == TC_S3TC_ARB)
{
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
}
else if (!noCompress && glConfig.textureCompression == TC_S3TC)
{
internalFormat = GL_RGB4_S3TC;
}
else if (r_textureBits->integer == 16)
{
internalFormat = GL_RGB5;
}
else if (r_textureBits->integer == 32)
{
internalFormat = GL_RGB8;
}
else
{
internalFormat = GL_RGB;
}
#endif

}
}
else if (samples == 4)
{
if (r_greyScale->integer)
{
#ifdef FEATURE_RENDERER_GLES
internalFormat = GL_LUMINANCE_ALPHA;
#else
if (r_textureBits->integer == 16)
{
internalFormat = GL_LUMINANCE8_ALPHA8;
}
else if (r_textureBits->integer == 32)
{
internalFormat = GL_LUMINANCE16_ALPHA16;
}
else
{
internalFormat = GL_LUMINANCE_ALPHA;
}
#endif
if (r_textureBits->integer == 16)
{
internalFormat = GL_LUMINANCE8_ALPHA8;
}
else if (r_textureBits->integer == 32)
{
internalFormat = GL_LUMINANCE16_ALPHA16;
}
else
{
internalFormat = GL_LUMINANCE_ALPHA;
}
}
else
{
#ifdef FEATURE_RENDERER_GLES
if (r_textureBits->integer == 16)
if (!noCompress && glConfig.textureCompression == TC_S3TC_ARB)
{
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
}
else if (r_textureBits->integer == 16)
{
internalFormat = GL_RGBA4;
}
else if (r_textureBits->integer == 32)
{
internalFormat = GL_RGBA8;
}
else
{
internalFormat = GL_RGBA;
internalFormat = GL_RGBA;
}
}
}
#else
if (!noCompress && glConfig.textureCompression == TC_S3TC_ARB)
{
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
}
else if (r_textureBits->integer == 16)
{
internalFormat = GL_RGBA4;
}
else if (r_textureBits->integer == 32)
{
internalFormat = GL_RGBA8;
}
else
{
internalFormat = GL_RGBA;
}
#endif
if (samples == 3)
{
if (r_greyScale->integer)
{
internalFormat = GL_LUMINANCE;
}
else if (r_textureBits->integer == 16)
{
internalFormat = GL_RGB5;
}
else
{
internalFormat = GL_RGB;
}
}
else if (samples == 4)
{
if (r_greyScale->integer)
{
internalFormat = GL_LUMINANCE_ALPHA;
}
else if (r_textureBits->integer == 16)
{
internalFormat = GL_RGBA4;
}
else
{
internalFormat = GL_RGBA;
}
}
#endif
}

#ifdef FEATURE_RENDERER_GLES