FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TTF & SDL_BlitSurface problem

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
Nrgyzer



Joined: 12 Dec 2009
Posts: 31

PostPosted: Sun Oct 31, 2010 3:59 pm    Post subject: TTF & SDL_BlitSurface problem Reply with quote

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 Smile.

Edit:\\ Solved - I forgot SDL_SetAlpha(image, 0, 0); before blitting image to intermediary.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group