Fixed creating an OpenGL texture from a surface
authorSam Lantinga <slouken@libsdl.org>
Sat Jan 28 12:38:26 2012 -0500
changeset 198ed936e59e023
parent 197 5be4d8d759b5
child 199 02dc34137aa2
Fixed creating an OpenGL texture from a surface
glfont.c
     1.1 --- a/glfont.c	Sat Jan 28 12:22:10 2012 -0500
     1.2 +++ b/glfont.c	Sat Jan 28 12:38:26 2012 -0500
     1.3 @@ -99,6 +99,7 @@
     1.4  	SDL_Surface *image;
     1.5  	SDL_Rect area;
     1.6  	Uint8  saved_alpha;
     1.7 +    SDL_BlendMode saved_mode;
     1.8  
     1.9  	/* Use the surface width and height expanded to powers of 2 */
    1.10  	w = power_of_two(surface->w);
    1.11 @@ -131,6 +132,8 @@
    1.12  	/* Save the alpha blending attributes */
    1.13  	SDL_GetSurfaceAlphaMod(surface, &saved_alpha);
    1.14  	SDL_SetSurfaceAlphaMod(surface, 0xFF);
    1.15 +    SDL_GetSurfaceBlendMode(surface, &saved_mode);
    1.16 +    SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE);
    1.17  
    1.18  	/* Copy the surface into the GL texture image */
    1.19  	area.x = 0;
    1.20 @@ -141,6 +144,7 @@
    1.21  
    1.22  	/* Restore the alpha blending attributes */
    1.23  	SDL_SetSurfaceAlphaMod(surface, saved_alpha);
    1.24 +    SDL_SetSurfaceBlendMode(surface, saved_mode);
    1.25  
    1.26  	/* Create an OpenGL texture for the image */
    1.27  	glGenTextures(1, &texture);