Hi. please look at this piece of code:
long colorkey;
SDL_Surface *app;
if(app=SDL_LoadBMP(filename))
{
colorkey=SDL_MapRGB(app->format,0,0,0);
SDL_SetColorKey(app, SDL_SRCCOLORKEY | SDL_RLEACCEL ,colorkey );
bmp=SDL_DisplayFormat(app);
SDL_FreeSurface(app);
}
this, I think, will set the color key value to black on the "bmp"
surface.
I use this code to create a surface containing a bitmap font to blit on
my opengl screen.
I blit the characters like this…
SDL_BlitSurface(bmp,&src,dest,&dst);
all is ok…
In the main part of my Game i use this code to draw my stuffs…
SDL_FillRect(gamesurface,NULL,SDL_MapRGBA(gamesurface->format,255,255,255,128));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
cuberot->Set(0.01time,0.03time,0); // this rotates my cude
txt->Write(0,140,“THIS IS THE GAME INTRO”); // this will blit some
strings…
txt->Write(0,180,“PRESS ESC TO SKIP”);
engine->DrawAll(); // this will draw my 3d stuffs
SDL_UpdateRect(gamesurface, 0, 0, 0, 0); // this is to update sdl
surface…
So… what’s the problem?
Characters are blitted on screen with a black box around… color key
doesn’t work…
The cube and the strings are drawn in the correct order (strings over
the cube…)
And… what’s my main problem??
I want draw a “hud” display on my opengl screen… obviusly with color
keyng…
what’s wrong?
thanks!