Formatting cleanup, and cleanup on gl-fog.c
This commit is contained in:
parent
46ed1d5353
commit
3df4244bc2
24
gl-api.c
24
gl-api.c
|
@ -267,8 +267,7 @@ void APIENTRY glColor4fv(const GLfloat *rgba) {
|
|||
//== Texture Coordinate Submission ==//
|
||||
|
||||
void APIENTRY glTexCoord2f(GLfloat u, GLfloat v) {
|
||||
if(_glKosEnabledTextureMatrix())
|
||||
{
|
||||
if(_glKosEnabledTextureMatrix()) {
|
||||
_glKosMatrixLoadTexture();
|
||||
|
||||
mat_trans_texture2_nomod(u, v, GL_KOS_VERTEX_UV[0], GL_KOS_VERTEX_UV[1]);
|
||||
|
@ -282,8 +281,7 @@ void APIENTRY glTexCoord2f(GLfloat u, GLfloat v) {
|
|||
}
|
||||
|
||||
void APIENTRY glTexCoord2fv(const GLfloat *uv) {
|
||||
if(_glKosEnabledTextureMatrix())
|
||||
{
|
||||
if(_glKosEnabledTextureMatrix()) {
|
||||
_glKosMatrixLoadTexture();
|
||||
|
||||
mat_trans_texture2_nomod(uv[0], uv[1], GL_KOS_VERTEX_UV[0], GL_KOS_VERTEX_UV[1]);
|
||||
|
@ -946,32 +944,26 @@ GLuint _glKosVertexColor() {
|
|||
return GL_KOS_VERTEX_COLOR;
|
||||
}
|
||||
|
||||
void glAlphaFunc(GLenum func, GLclampf ref)
|
||||
{
|
||||
void glAlphaFunc(GLenum func, GLclampf ref) {
|
||||
;
|
||||
}
|
||||
|
||||
void glLineWidth(GLfloat width)
|
||||
{
|
||||
void glLineWidth(GLfloat width) {
|
||||
;
|
||||
}
|
||||
|
||||
void glPolygonOffset(GLfloat factor, GLfloat units)
|
||||
{
|
||||
void glPolygonOffset(GLfloat factor, GLfloat units) {
|
||||
;
|
||||
}
|
||||
|
||||
void glGetTexParameteriv(GLenum target, GLenum pname, GLint * params)
|
||||
{
|
||||
void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params) {
|
||||
;
|
||||
}
|
||||
|
||||
void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
|
||||
{
|
||||
void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
|
||||
;
|
||||
}
|
||||
|
||||
void glPixelStorei(GLenum pname, GLint param)
|
||||
{
|
||||
void glPixelStorei(GLenum pname, GLint param) {
|
||||
;
|
||||
}
|
||||
|
|
21
gl-arrays.c
21
gl-arrays.c
|
@ -461,12 +461,10 @@ static inline void _glKosElementTexCoord2fU16(pvr_vertex_t *dst, GLuint count) {
|
|||
GLuint i, index;
|
||||
GLfloat *t = GL_KOS_TEXCOORD0_POINTER;
|
||||
|
||||
if(_glKosEnabledTextureMatrix())
|
||||
{
|
||||
if(_glKosEnabledTextureMatrix()) {
|
||||
_glKosMatrixLoadTexture();
|
||||
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
for(i = 0; i < count; i++) {
|
||||
index = GL_KOS_INDEX_POINTER_U16[i] * GL_KOS_TEXCOORD0_STRIDE;
|
||||
|
||||
mat_trans_texture2_nomod(t[index], t[index + 1], dst[i].u, dst[i].v);
|
||||
|
@ -487,12 +485,10 @@ static inline void _glKosElementTexCoord2fU8(pvr_vertex_t *dst, GLuint count) {
|
|||
GLuint i, index;
|
||||
GLfloat *t = GL_KOS_TEXCOORD0_POINTER;
|
||||
|
||||
if(_glKosEnabledTextureMatrix())
|
||||
{
|
||||
if(_glKosEnabledTextureMatrix()) {
|
||||
_glKosMatrixLoadTexture();
|
||||
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
for(i = 0; i < count; i++) {
|
||||
index = GL_KOS_INDEX_POINTER_U8[i] * GL_KOS_TEXCOORD0_STRIDE;
|
||||
|
||||
mat_trans_texture2_nomod(t[index], t[index + 1], dst[i].u, dst[i].v);
|
||||
|
@ -1051,12 +1047,10 @@ static inline void _glKosArrayTexCoord2f(pvr_vertex_t *dst, GLuint count) {
|
|||
GLuint i;
|
||||
GLfloat *uv = GL_KOS_TEXCOORD0_POINTER;
|
||||
|
||||
if(_glKosEnabledTextureMatrix())
|
||||
{
|
||||
if(_glKosEnabledTextureMatrix()) {
|
||||
_glKosMatrixLoadTexture();
|
||||
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
for(i = 0; i < count; i++) {
|
||||
mat_trans_texture2_nomod(uv[0], uv[1], dst[i].u, dst[i].v);
|
||||
|
||||
uv += GL_KOS_TEXCOORD0_STRIDE;
|
||||
|
@ -1064,8 +1058,7 @@ static inline void _glKosArrayTexCoord2f(pvr_vertex_t *dst, GLuint count) {
|
|||
|
||||
_glKosMatrixLoadRender();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
for(i = 0; i < count; i++) {
|
||||
dst[i].u = uv[0];
|
||||
dst[i].v = uv[1];
|
||||
|
|
6
gl-cap.c
6
gl-cap.c
|
@ -228,10 +228,8 @@ void APIENTRY glGetFloatv(GLenum pname, GLfloat *params) {
|
|||
}
|
||||
}
|
||||
|
||||
const GLbyte* glGetString(GLenum name)
|
||||
{
|
||||
switch(name)
|
||||
{
|
||||
const GLbyte *glGetString(GLenum name) {
|
||||
switch(name) {
|
||||
case GL_VENDOR:
|
||||
return "KallistiOS";
|
||||
|
||||
|
|
79
gl-fog.c
79
gl-fog.c
|
@ -11,92 +11,85 @@
|
|||
|
||||
#include "gl.h"
|
||||
|
||||
static GLuint FOG_MODE = GL_EXP; /* GL_LINEAR, GL_EXP, or GL_EXP2 FOG */
|
||||
static GLfloat FOG_DENSITY = 1.0f, /* Density - GL_EXP, or GL_EXP2 FOG */
|
||||
FOG_START = 0.0f, /* Linear FOG */
|
||||
FOG_END = 1.0f; /* Linear FOG */
|
||||
static GLuint GL_KOS_FOG_MODE = GL_EXP; /* GL_LINEAR, GL_EXP, or GL_EXP2 FOG */
|
||||
static GLfloat GL_KOS_FOG_DENSITY = 1.0f, /* Density - GL_EXP, or GL_EXP2 FOG */
|
||||
GL_KOS_FOG_START = 0.0f, /* Linear FOG */
|
||||
GL_KOS_FOG_END = 1.0f; /* Linear FOG */
|
||||
|
||||
void APIENTRY glFogi(GLenum pname, GLint param) {
|
||||
switch(pname) {
|
||||
case GL_FOG_MODE:
|
||||
switch(param) {
|
||||
case GL_LINEAR:
|
||||
return pvr_fog_table_linear(FOG_START, FOG_END);
|
||||
pvr_fog_table_linear(GL_KOS_FOG_START, GL_KOS_FOG_END);
|
||||
break;
|
||||
|
||||
case GL_EXP:
|
||||
return pvr_fog_table_exp(FOG_DENSITY);
|
||||
pvr_fog_table_exp(GL_KOS_FOG_DENSITY);
|
||||
break;
|
||||
|
||||
case GL_EXP2:
|
||||
return pvr_fog_table_exp2(FOG_DENSITY);
|
||||
|
||||
default:
|
||||
return;
|
||||
pvr_fog_table_exp2(GL_KOS_FOG_DENSITY);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void APIENTRY glFogf(GLenum pname, GLfloat param) {
|
||||
switch(pname) {
|
||||
case GL_FOG_START:
|
||||
FOG_START = param;
|
||||
GL_KOS_FOG_START = param;
|
||||
|
||||
if(FOG_MODE == GL_LINEAR)
|
||||
return pvr_fog_table_linear(FOG_START, FOG_END);
|
||||
if(GL_KOS_FOG_MODE == GL_LINEAR)
|
||||
pvr_fog_table_linear(GL_KOS_FOG_START, GL_KOS_FOG_END);
|
||||
|
||||
return;
|
||||
break;
|
||||
|
||||
case GL_FOG_END:
|
||||
FOG_END = param;
|
||||
GL_KOS_FOG_END = param;
|
||||
|
||||
if(FOG_MODE == GL_LINEAR)
|
||||
return pvr_fog_table_linear(FOG_START, FOG_END);
|
||||
if(GL_KOS_FOG_MODE == GL_LINEAR)
|
||||
pvr_fog_table_linear(GL_KOS_FOG_START, GL_KOS_FOG_END);
|
||||
|
||||
return;
|
||||
break;
|
||||
|
||||
case GL_FOG_DENSITY:
|
||||
FOG_DENSITY = param;
|
||||
GL_KOS_FOG_DENSITY = param;
|
||||
|
||||
if(FOG_MODE == GL_EXP)
|
||||
return pvr_fog_table_exp(FOG_DENSITY);
|
||||
if(GL_KOS_FOG_MODE == GL_EXP)
|
||||
pvr_fog_table_exp(GL_KOS_FOG_DENSITY);
|
||||
|
||||
if(FOG_MODE == GL_EXP2)
|
||||
return pvr_fog_table_exp2(FOG_DENSITY);
|
||||
else if(GL_KOS_FOG_MODE == GL_EXP2)
|
||||
pvr_fog_table_exp2(GL_KOS_FOG_DENSITY);
|
||||
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void APIENTRY glFogfv(GLenum pname, const GLfloat *params) {
|
||||
switch(pname) {
|
||||
case GL_FOG_MODE:
|
||||
return glFogi(pname, (GLint) * params);
|
||||
glFogi(pname, (GLint) * params);
|
||||
break;
|
||||
|
||||
case GL_FOG_DENSITY:
|
||||
FOG_DENSITY = *params;
|
||||
GL_KOS_FOG_DENSITY = *params;
|
||||
|
||||
if(FOG_MODE == GL_EXP)
|
||||
return pvr_fog_table_exp(FOG_DENSITY);
|
||||
if(GL_KOS_FOG_MODE == GL_EXP)
|
||||
pvr_fog_table_exp(GL_KOS_FOG_DENSITY);
|
||||
|
||||
if(FOG_MODE == GL_EXP2)
|
||||
return pvr_fog_table_exp2(FOG_DENSITY);
|
||||
else if(GL_KOS_FOG_MODE == GL_EXP2)
|
||||
pvr_fog_table_exp2(GL_KOS_FOG_DENSITY);
|
||||
|
||||
return;
|
||||
break;
|
||||
|
||||
case GL_FOG_START:
|
||||
case GL_FOG_END:
|
||||
return glFogf(pname, *params);
|
||||
glFogf(pname, *params);
|
||||
break;
|
||||
|
||||
case GL_FOG_COLOR:
|
||||
return pvr_fog_table_color(params[3], params[0], params[1], params[2]);
|
||||
|
||||
case GL_FOG_INDEX:
|
||||
default:
|
||||
return;
|
||||
pvr_fog_table_color(params[3], params[0], params[1], params[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ void _glKosEnableLight(const GLuint light) {
|
|||
GL_LIGHT_ENABLED |= (1 << (light & 0xF));
|
||||
}
|
||||
|
||||
/* Disable a light - GL_LIGHT0->GL_LIGHT7 */
|
||||
/* Disable a light - GL_LIGHT0->GL_LIGHT0 + GL_KOS_MAX_LIGHTS */
|
||||
void _glKosDisableLight(const GLuint light) {
|
||||
if(light < GL_LIGHT0 || light > GL_LIGHT0 + GL_KOS_MAX_LIGHTS) {
|
||||
_glKosThrowError(GL_INVALID_ENUM, "glDisable(GL_LIGHT)");
|
||||
|
@ -152,7 +152,7 @@ static inline void glCopy3f(const float *src, float *dst) {
|
|||
/* GL Light Parameters ******************************************************/
|
||||
|
||||
void glLightfv(GLenum light, GLenum pname, const GLfloat *params) {
|
||||
if(light < GL_LIGHT0 || light > GL_LIGHT7) return;
|
||||
if(light < GL_LIGHT0 || light > GL_LIGHT0 + GL_KOS_MAX_LIGHTS) return;
|
||||
|
||||
switch(pname) {
|
||||
case GL_AMBIENT:
|
||||
|
@ -217,7 +217,7 @@ void glLightfv(GLenum light, GLenum pname, const GLfloat *params) {
|
|||
}
|
||||
|
||||
void glLightf(GLenum light, GLenum pname, GLfloat param) {
|
||||
if(light < GL_LIGHT0 || light > GL_LIGHT7) return;
|
||||
if(light < GL_LIGHT0 || light > GL_LIGHT0 + GL_KOS_MAX_LIGHTS) return;
|
||||
|
||||
switch(pname) {
|
||||
case GL_CONSTANT_ATTENUATION:
|
||||
|
|
80
gl-rgb.c
80
gl-rgb.c
|
@ -119,37 +119,33 @@ uint16 __glKosAverageBiPixelARGB4444(uint16 p1, uint16 p2) {
|
|||
//===================================================================================================//
|
||||
//== Colorspace Conversion ==//
|
||||
|
||||
static uint16 _glConvPixelRGBAU32(uint8 r, uint8 g, uint8 b, uint8 a)
|
||||
{
|
||||
static uint16 _glConvPixelRGBAU32(uint8 r, uint8 g, uint8 b, uint8 a) {
|
||||
return (uint16)((a & RGB4_MAX) << ARGB4444_ALPHA_SHIFT) |
|
||||
((r & RGB4_MAX) << ARGB4444_RED_SHIFT) |
|
||||
((g & RGB4_MAX) << ARGB4444_GREEN_SHIFT) |
|
||||
((b & RGB4_MAX));
|
||||
}
|
||||
|
||||
static uint16 _glConvPixelRGBU24(uint8 r, uint8 g, uint8 b)
|
||||
{
|
||||
static uint16 _glConvPixelRGBU24(uint8 r, uint8 g, uint8 b) {
|
||||
return (uint16)((r & RGB5_MAX) << RGB565_RED_SHIFT) |
|
||||
((g & RGB6_MAX) << RGB565_GREEN_SHIFT) |
|
||||
((b & RGB5_MAX));
|
||||
}
|
||||
|
||||
static void _glConvPixelsRGBF(int w, int h, float * src, uint16 * dst)
|
||||
{
|
||||
static void _glConvPixelsRGBF(int w, int h, float *src, uint16 *dst) {
|
||||
int i;
|
||||
for(i = 0; i < w * h; i++)
|
||||
{
|
||||
|
||||
for(i = 0; i < w * h; i++) {
|
||||
dst[i] = _glConvPixelRGBU24((uint8)(src[i * 3 + 0] * RGB5_MAX),
|
||||
(uint8)(src[i * 3 + 1] * RGB6_MAX),
|
||||
(uint8)(src[i * 3 + 2] * RGB5_MAX));
|
||||
}
|
||||
}
|
||||
|
||||
static void _glConvPixelsRGBAF(int w, int h, float * src, uint16 * dst)
|
||||
{
|
||||
static void _glConvPixelsRGBAF(int w, int h, float *src, uint16 *dst) {
|
||||
int i;
|
||||
for(i = 0; i < w * h; i++)
|
||||
{
|
||||
|
||||
for(i = 0; i < w * h; i++) {
|
||||
dst[i] = _glConvPixelRGBAU32((uint8)(src[i * 4 + 0] * RGB4_MAX),
|
||||
(uint8)(src[i * 4 + 1] * RGB4_MAX),
|
||||
(uint8)(src[i * 4 + 2] * RGB4_MAX),
|
||||
|
@ -157,13 +153,11 @@ static void _glConvPixelsRGBAF(int w, int h, float * src, uint16 * dst)
|
|||
}
|
||||
}
|
||||
|
||||
static void _glConvPixelsRGBU24(int w, int h, uint8 * src, uint16 * dst)
|
||||
{
|
||||
static void _glConvPixelsRGBU24(int w, int h, uint8 *src, uint16 *dst) {
|
||||
unsigned char r, g, b;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < w * h; i++)
|
||||
{
|
||||
for(i = 0; i < w * h; i++) {
|
||||
r = (src[i * 3 + 0] * RGB5_MAX) / RGB8_MAX;
|
||||
g = (src[i * 3 + 1] * RGB6_MAX) / RGB8_MAX;
|
||||
b = (src[i * 3 + 2] * RGB5_MAX) / RGB8_MAX;
|
||||
|
@ -172,13 +166,11 @@ static void _glConvPixelsRGBU24(int w, int h, uint8 * src, uint16 * dst)
|
|||
}
|
||||
}
|
||||
|
||||
static void _glConvPixelsRGBAU32(int w, int h, uint8 * src, uint16 * dst)
|
||||
{
|
||||
static void _glConvPixelsRGBAU32(int w, int h, uint8 *src, uint16 *dst) {
|
||||
unsigned char r, g, b, a;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < w * h; i++)
|
||||
{
|
||||
for(i = 0; i < w * h; i++) {
|
||||
r = (src[i * 4 + 0] * RGB4_MAX) / RGB8_MAX;
|
||||
g = (src[i * 4 + 1] * RGB4_MAX) / RGB8_MAX;
|
||||
b = (src[i * 4 + 2] * RGB4_MAX) / RGB8_MAX;
|
||||
|
@ -188,13 +180,11 @@ static void _glConvPixelsRGBAU32(int w, int h, uint8 * src, uint16 * dst)
|
|||
}
|
||||
}
|
||||
|
||||
static void _glConvPixelsRGBS24(int w, int h, int8 * src, uint16 * dst)
|
||||
{
|
||||
static void _glConvPixelsRGBS24(int w, int h, int8 *src, uint16 *dst) {
|
||||
unsigned char r, g, b;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < w * h; i++)
|
||||
{
|
||||
for(i = 0; i < w * h; i++) {
|
||||
r = ((src[i * 3 + 0] + S8_NEG_OFT) * RGB5_MAX) / RGB8_MAX;
|
||||
g = ((src[i * 3 + 1] + S8_NEG_OFT) * RGB6_MAX) / RGB8_MAX;
|
||||
b = ((src[i * 3 + 2] + S8_NEG_OFT) * RGB5_MAX) / RGB8_MAX;
|
||||
|
@ -203,13 +193,11 @@ static void _glConvPixelsRGBS24(int w, int h, int8 * src, uint16 * dst)
|
|||
}
|
||||
}
|
||||
|
||||
static void _glConvPixelsRGBAS32(int w, int h, int8 * src, uint16 * dst)
|
||||
{
|
||||
static void _glConvPixelsRGBAS32(int w, int h, int8 *src, uint16 *dst) {
|
||||
unsigned char r, g, b, a;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < w * h; i++)
|
||||
{
|
||||
for(i = 0; i < w * h; i++) {
|
||||
r = ((src[i * 4 + 0] + S8_NEG_OFT) * RGB4_MAX) / RGB8_MAX;
|
||||
g = ((src[i * 4 + 1] + S8_NEG_OFT) * RGB4_MAX) / RGB8_MAX;
|
||||
b = ((src[i * 4 + 2] + S8_NEG_OFT) * RGB4_MAX) / RGB8_MAX;
|
||||
|
@ -219,13 +207,11 @@ static void _glConvPixelsRGBAS32(int w, int h, int8 * src, uint16 * dst)
|
|||
}
|
||||
}
|
||||
|
||||
static void _glConvPixelsRGBS48(int w, int h, int16 * src, uint16 * dst)
|
||||
{
|
||||
static void _glConvPixelsRGBS48(int w, int h, int16 *src, uint16 *dst) {
|
||||
unsigned char r, g, b;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < w * h; i++)
|
||||
{
|
||||
for(i = 0; i < w * h; i++) {
|
||||
r = ((src[i * 3 + 0] + S16_NEG_OFT) * RGB5_MAX) / RGB16_MAX;
|
||||
g = ((src[i * 3 + 1] + S16_NEG_OFT) * RGB6_MAX) / RGB16_MAX;
|
||||
b = ((src[i * 3 + 2] + S16_NEG_OFT) * RGB5_MAX) / RGB16_MAX;
|
||||
|
@ -234,13 +220,11 @@ static void _glConvPixelsRGBS48(int w, int h, int16 * src, uint16 * dst)
|
|||
}
|
||||
}
|
||||
|
||||
static void _glConvPixelsRGBAS64(int w, int h, int16 * src, uint16 * dst)
|
||||
{
|
||||
static void _glConvPixelsRGBAS64(int w, int h, int16 *src, uint16 *dst) {
|
||||
unsigned char r, g, b, a;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < w * h; i++)
|
||||
{
|
||||
for(i = 0; i < w * h; i++) {
|
||||
r = ((src[i * 4 + 0] + S16_NEG_OFT) * RGB4_MAX) / RGB16_MAX;
|
||||
g = ((src[i * 4 + 1] + S16_NEG_OFT) * RGB4_MAX) / RGB16_MAX;
|
||||
b = ((src[i * 4 + 2] + S16_NEG_OFT) * RGB4_MAX) / RGB16_MAX;
|
||||
|
@ -250,13 +234,11 @@ static void _glConvPixelsRGBAS64(int w, int h, int16 * src, uint16 * dst)
|
|||
}
|
||||
}
|
||||
|
||||
static void _glConvPixelsRGBU48(int w, int h, uint16 * src, uint16 * dst)
|
||||
{
|
||||
static void _glConvPixelsRGBU48(int w, int h, uint16 *src, uint16 *dst) {
|
||||
unsigned char r, g, b;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < w * h; i++)
|
||||
{
|
||||
for(i = 0; i < w * h; i++) {
|
||||
r = ((src[i * 3 + 0]) * RGB5_MAX) / RGB16_MAX;
|
||||
g = ((src[i * 3 + 1]) * RGB6_MAX) / RGB16_MAX;
|
||||
b = ((src[i * 3 + 2]) * RGB5_MAX) / RGB16_MAX;
|
||||
|
@ -265,13 +247,11 @@ static void _glConvPixelsRGBU48(int w, int h, uint16 * src, uint16 * dst)
|
|||
}
|
||||
}
|
||||
|
||||
static void _glConvPixelsRGBAU64(int w, int h, uint16 * src, uint16 * dst)
|
||||
{
|
||||
static void _glConvPixelsRGBAU64(int w, int h, uint16 *src, uint16 *dst) {
|
||||
unsigned char r, g, b, a;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < w * h; i++)
|
||||
{
|
||||
for(i = 0; i < w * h; i++) {
|
||||
r = (src[i * 4 + 0] * RGB4_MAX) / RGB16_MAX;
|
||||
g = (src[i * 4 + 1] * RGB4_MAX) / RGB16_MAX;
|
||||
b = (src[i * 4 + 2] * RGB4_MAX) / RGB16_MAX;
|
||||
|
@ -281,10 +261,8 @@ static void _glConvPixelsRGBAU64(int w, int h, uint16 * src, uint16 * dst)
|
|||
}
|
||||
}
|
||||
|
||||
void _glPixelConvertRGB(int format, int w, int h, void * src, uint16 * dst)
|
||||
{
|
||||
switch(format)
|
||||
{
|
||||
void _glPixelConvertRGB(int format, int w, int h, void *src, uint16 *dst) {
|
||||
switch(format) {
|
||||
case GL_BYTE:
|
||||
_glConvPixelsRGBS24(w, h, (int8 *)src, dst);
|
||||
break;
|
||||
|
@ -307,10 +285,8 @@ void _glPixelConvertRGB(int format, int w, int h, void * src, uint16 * dst)
|
|||
}
|
||||
}
|
||||
|
||||
void _glPixelConvertRGBA(int format, int w, int h, void * src, uint16 * dst)
|
||||
{
|
||||
switch(format)
|
||||
{
|
||||
void _glPixelConvertRGBA(int format, int w, int h, void *src, uint16 *dst) {
|
||||
switch(format) {
|
||||
case GL_BYTE:
|
||||
_glConvPixelsRGBAS32(w, h, (int8 *)src, dst);
|
||||
break;
|
||||
|
|
4
gl-rgb.h
4
gl-rgb.h
|
@ -64,7 +64,7 @@ typedef GLfloat GLrgba4f[4];
|
|||
#define S8_NEG_OFT 128 // Absolute Value of Minimum 8bit Signed Range //
|
||||
#define S16_NEG_OFT 32768 // Absolute Value of Minimum bit Signed Range //
|
||||
|
||||
void _glPixelConvertRGB(int format, int w, int h, void * src, uint16 * dst);
|
||||
void _glPixelConvertRGBA(int format, int w, int h, void * src, uint16 * dst);
|
||||
void _glPixelConvertRGB(int format, int w, int h, void *src, uint16 *dst);
|
||||
void _glPixelConvertRGBA(int format, int w, int h, void *src, uint16 *dst);
|
||||
|
||||
#endif
|
||||
|
|
13
gl-texture.c
13
gl-texture.c
|
@ -254,27 +254,24 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
|||
|
||||
GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->data = pvr_mem_malloc(bytes);
|
||||
|
||||
if(data)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
if(data) {
|
||||
switch(type) {
|
||||
case GL_BYTE: /* Texture Formats that need conversion for PVR */
|
||||
case GL_UNSIGNED_BYTE:
|
||||
case GL_SHORT:
|
||||
case GL_UNSIGNED_SHORT:
|
||||
case GL_FLOAT:
|
||||
{
|
||||
case GL_FLOAT: {
|
||||
uint16 *tex;
|
||||
|
||||
tex = (uint16 *)malloc(width * height * sizeof(uint16));
|
||||
|
||||
if(!tex) {
|
||||
_glKosThrowError(GL_OUT_OF_MEMORY, "glTexImage2D");
|
||||
_glKosPrintError();
|
||||
return;
|
||||
}
|
||||
|
||||
switch(internalFormat)
|
||||
{
|
||||
switch(internalFormat) {
|
||||
case GL_RGB:
|
||||
_glPixelConvertRGB(type, width, height, (void *)data, tex);
|
||||
GL_KOS_TEXTURE_UNIT[GL_KOS_ACTIVE_TEXTURE]->color = (PVR_TXRFMT_RGB565 | PVR_TXRFMT_NONTWIDDLED);
|
||||
|
|
Loading…
Reference in New Issue
Block a user