Hi! I 'm working on loader of quake 2 model data and everything seems to be
good except colors eg. I’v got blue where it should be red …
I think that i’ve got BGRA not RGBA . So I’ve got Pc it is low endian
My initialzation :
…
SDL_GL_SetAttribute(SDL_GL_RED_SIZE,8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
screen=SDL_SetVideoMode(640,480,32,SDL_OPENGL|SDL_FULLSCREEN);
if(screen==0)
{
printf(“Failed: %s”,SDL_GetError());
return(1);
}
…
I’m useing SDL_image to load texture from file like below:
SDL_Surface *LoadTex(char *name)
{
SDL_Surface *texture;
SDL_Surface *image;
image=IMG_Load(name); //Get image from file
texture=SDL_DisplayFormatAlpha(image); // Convert it into screen parameters
SDL_FreeSurface(image); //free original image
return(texture);
}
And use this texture like this:
fglTexImage2D(GL_TEXTURE_2D,0,3,((*obj)->texture)->w,((*obj)->texture)->h,0,
GL_RGBA,GL_UNSIGNED_BYTE,((*obj)->texture)->pixel
For diffrent formats of the same picture
eg. pcx,bmp,tga result is always the same.
Thanks for reading…
Greetings Scorpion–
Tego nie znajdziesz w ?adnym sklepie!
[ http://oferty.onet.pl ]