Charlene Wendling: > + void color2(color_t color, ld part) { > + unsigned char *c = (unsigned char*) (&color); > + 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++) > ++ #if SDL_BYTEORDER == SDL_BIG_ENDIAN > ++ cols[3-i] = c[3-i] / 255.0 * part; > ++ #else > ++ cols[i] = c[3-i] / 255.0 * part; > ++ #endif
My poor brain. I think this is correct but confusing. It's the ordering of c[] that is affected by endianness, not the ordering of cols[]. Also, I think you want { } for clarity. for(int i=0; i<4; i++) { #if SDL_BYTEORDER == SDL_BIG_ENDIAN cols[i] = c[i] / 255.0 * part; #else cols[i] = c[3-i] / 255.0 * part; #endif } Or maybe just extract the color channels with arithmetic? void color2(color_t color, ld part) { GLfloat cols[4]; for(int i=0; i<4; i++) cols[0] = (color >> ((3-i) * 8) & 0xff) / 255.0 * part; ... The next function in shaders.cpp, colorClear(), is also wrong. -- Christian "naddy" Weisgerber na...@mips.inka.de