Nrgyzer
Joined: 12 Dec 2009 Posts: 31
|
Posted: Sun Oct 31, 2010 3:59 pm Post subject: TTF & SDL_BlitSurface problem |
|
|
Hey everyone,
I use TTF_RenderUTF8_Blended to render my text. To support older graphic cards, I try to convert the created surface to a valid 2^n graphic by using SDL_Blit. My source looks like:
Code: |
SDL_Surface* image = TTF_RenderUTF8_Blended(font.getFont(), (text ~ "\0").ptr, font.getColor());
int width = nextPowerOfTwo(image.w);
int height = nextPowerOfTwo(image.h);
SDL_Surface* intermediary = SDL_CreateRGBSurface(image.flags, width, height, image.format.BitsPerPixel, image.format.Rmask, image.format.Gmask, image.format.Bmask, image.format.Amask);
SDL_BlitSurface(image, null, intermediary, null);
toTexture(intermediary);
|
When I draw the scene, I see nothing, no text, nothing (like completely transparent). toTexture() converts the surface to an OpenGL texture and works for all other graphics of my application, so I'm sure toTexture() is correct.
Code: | SDL_BlitSurface(image, null, intermediary, null); |
Does also return 0 and when I call toTexture(image) I also see the text.
I hope anyone can help .
Edit:\\ Solved - I forgot SDL_SetAlpha(image, 0, 0); before blitting image to intermediary. |
|