1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
int loadSDLFont(char*filename, int taillepolice) {
SDL_Surface*surface = NULL;
SDL_Surface*soclefont = NULL;
TTF_Font*police = NULL;
SDL_Rect dimensionsoclefont;
GLint font;
SDL_Color color = {255, 255, 255};
police = TTF_OpenFont(filename, taillepolice);
surface = TTF_RenderText_Solid(police, "pspflashsystem", color);
if(surface > 0) {
soclefont = SDL_CreateRGBSurface(SDL_SWSURFACE, 256, 256, 24, surface->format->Rmask, surface->format->Gmask, surface->format->Bmask, surface->format->Amask);
SDL_BlitSurface(surface, NULL, soclefont, NULL);
glGenTextures(1, &font);
glBindTexture(GL_TEXTURE_2D, font);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, soclefont->pixels);
}
else {
exit(0);
}
return font;
} |