1
votes

We load textures through SDL_image, then we load them into OpenGL through textimage2d:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h,
0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, (GLuint**)texture->pixels );

On my windows machine, that runs fine, but on my friends Mac machine the colors seem to be shifted around. He got a strong blueish texture on his display. Of course, that has to deal with the internalFormat (here GL_BGRA_EXT). We tried all we found and running (compiling correctly) but none gives a correct output for mac. Any ideas how to get an idea about how mac computes the pixels array provided by SDL_image?

2
"the internalFormat (here GL_BGRA_EXT)" No, the internal format of the texture is GL_RGBA. Also, it's hard to know what's wrong if you can't describe the actual problem any better than "a strong blueish texture". Can you not provide a screenshot of the problem and the fixed version?Nicol Bolas

2 Answers

0
votes

I haven't started using SDL openGL yet but here are some potential keywords that might be relevant.

RGBA/BGRA?

Colors are off in SDL program

http://www.opengl.org/wiki/Common_Mistakes

#if for TARGET_CPU_PPC and using a consistent value like GL_RGBA for everything.

Hope this can get you started.

0
votes

Okay thanks to your links, some investigation and lost brain cells, we came to the result that we can detect the order of pixel data trough the defined masks in the sdl surface (surface->format->Rmask) to decide if we use GL_UNSIGNED_INT_8_8_8_8 or GL_UNSIGNED_INT_8_8_8_8_REV.