mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-20 23:50:27 +00:00
Fix colors for big endian architectures.
This commit is contained in:
parent
87240cf990
commit
9cee52cf81
@ -766,7 +766,12 @@ void fixMercator(bool tinf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned char& part(color_t& col, int i) {
|
unsigned char& part(color_t& col, int i) {
|
||||||
unsigned char* c = (unsigned char*) &col; return c[i];
|
unsigned char* c = (unsigned char*) &col;
|
||||||
|
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||||
|
return c[sizeof(col) - 1 - i];
|
||||||
|
#else
|
||||||
|
return c[i];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool in_twopoint = false;
|
bool in_twopoint = false;
|
||||||
|
10
shaders.cpp
10
shaders.cpp
@ -341,9 +341,9 @@ void id_modelview() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void color2(color_t color, ld part) {
|
void color2(color_t color, ld part) {
|
||||||
unsigned char *c = (unsigned char*) (&color);
|
|
||||||
GLfloat cols[4];
|
GLfloat cols[4];
|
||||||
for(int i=0; i<4; i++) cols[i] = c[3-i] / 255.0 * part;
|
for(int i=0; i<4; i++)
|
||||||
|
cols[i] = (color >> ((3-i) * 8) & 0xff) / 255.0 * part;
|
||||||
#if CAP_SHADER
|
#if CAP_SHADER
|
||||||
// glUniform4fv(current->uFog, 4, cols);
|
// glUniform4fv(current->uFog, 4, cols);
|
||||||
if(!current) return;
|
if(!current) return;
|
||||||
@ -355,8 +355,12 @@ void color2(color_t color, ld part) {
|
|||||||
|
|
||||||
void colorClear(color_t color) {
|
void colorClear(color_t color) {
|
||||||
unsigned char *c = (unsigned char*) (&color);
|
unsigned char *c = (unsigned char*) (&color);
|
||||||
|
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||||
|
glClearColor(c[0] / 255.0, c[1] / 255.0, c[2]/255.0, c[3] / 255.0);
|
||||||
|
#else
|
||||||
glClearColor(c[3] / 255.0, c[2] / 255.0, c[1]/255.0, c[0] / 255.0);
|
glClearColor(c[3] / 255.0, c[2] / 255.0, c[1]/255.0, c[0] / 255.0);
|
||||||
}
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void be_nontextured(shader_projection sp) { switch_mode(gmColored, sp); }
|
void be_nontextured(shader_projection sp) { switch_mode(gmColored, sp); }
|
||||||
void be_textured(shader_projection sp) { switch_mode(gmTextured, sp); }
|
void be_textured(shader_projection sp) { switch_mode(gmTextured, sp); }
|
||||||
|
Loading…
Reference in New Issue
Block a user