   [SDL] Blitting one surface to another
  My current game is being made in C++ with OpenGL using SDL to create the window, input, etc. I also am using SDL_ttf for rendering text. I am working on making my font render split text up into multiple lines if it goes out of the text box in my GUI. I've already got the part that breaks one long string into each line working. Which leaves me with an std::vector<std::string> with all the strings in it. My problem is that when I render these text to surfaces, and try to blit them onto a 'master' img(and the final one that I will draw to the screen), nothing happens. I get no error from SDL_GetError() and SDL_BlitSurface() returns 0. I have never actually blitted from one surface to another, just always blitted from one surface to the screen, but that should be the same, at least I thought.Here's the relevant code:textIMG = SDL_CreateRGBSurface(SDL_SWSURFACE,width,lines.size()*fontSize,32,0xff000000,0x00ff0000,0x0000ff00,0x000000ff);SDL_UnlockSurface(textIMG);   //Loops through all the std::strings in my vecotor that contains all the linesfor(int i = 0; i < lines.size(); i++){//Create a temporary img and render the text to itSDL_Surface *img = TTF_RenderText_Blended(font, lines.c_str(), color);SDL_ConvertSurface(img,textIMG->format,SDL_SWSURFACE);SDL_Rect rect;rect.x=0;rect.y=fontSize*i;SDL_SaveBMP(img,"img.bmp");//For debuging purposesSDL_BlitSurface(img,NULL,textIMG,&rect);//Draw it to the main imgSDL_FreeSurface(img);}SDL_LockSurface(textIMG);SDL_SaveBMP(textIMG,"test.bmp");//To help debugtest.bmp is completely, totally black when I check it. It should have all the lines of text blitted onto it. img.bmp has the text correctly drawn to it. So, that leaves the problem to SDL_BlitSurface().Any suggestions as to what to do?Thanks in advanced!   
  Get rid of the UnLock/LockSurface stuff for textIMG, it should already be unlocked when it comes out of CreateRGBSurface()Note that ConvertSurface() returns the newly converted surface, so it goes like this:SDL_Surface* newimg = SDL_ConvertSurface(img,textIMG->format,SDL_SWSURFACE);if(newimg)  SDL_FreeSurface(img);else   ;//Oh crap, handle error hereimg = newimgSetting w/h doesn't hurt eitherrect.w = img->clip_rect.w;rect.h = img->clip_rect.h;Finally, 32bit surface alpha mask may be messed up or have side effects.Try a 24bit surface to check if this is the case. If this is the case then see SDL_SetAlpha() docs to correct.surf = SDL_CreateRGBSurface(SDL_SWSURFACE,width,lines.size()*fontSize,24,0xFF0000,0x00FF00,0x0000FF,0x000000);Good Luck.   ;  Many thanks!I eventually got it with your help, and some geussing. GDNet member pointed me in the way of SDL_FillRect(), which made it work.Again, thanks.   