Advertisement

Display formating (SDL)

Started by February 16, 2005 06:44 PM
8 comments, last by Kitasia 20 years ago
Things seem to move slower when I display format than when I don't. What could I be doing wrong?
I used surface = SDL_DisplayFormat(surface) instead of just loading the surface and just blitting. The process seems to be much slower.
Advertisement
Quote:
Original post by AntiGuy
I used surface = SDL_DisplayFormat(surface) instead of just loading the surface and just blitting. The process seems to be much slower.

Are you freeing the surface after you use SDL_DisplayFormat?


temp = SDL_DisplayFormat(surface);SDL_FreeSurface( surface );surface = temp;
Yeah, that didn't help.
Define "slower" and show us some code. One could only guess what's wrong at this point.
#include "Main.h"SDL_Surface* surface;SDL_Surface* temp;int main(int argc, char* argv[])  {LoadGame();temp = IMG_Load("Images/image.gif");surface= SDL_DisplayFormat(temp);SDL_FreeSurface(temp);for(;;){SDL_PollEvent(&event);SDL_BlitSurface(surface,0,screen,0);SDL_Flip(screen);CalculateFrameRate();}}


And by slow I mean the framerate slows down. It moves much faster if I say surface = IMG_Load("image");
Advertisement
Does IMG_Load load into a hardware surface by default? The only thing I can think of is you were blitting hw -> hw before and now you're blitting sw -> hw. hw -> hw accelerated blits are usually much faster. Also, take that SDL_Flip out for raw speed calculations, it might be waiting for retrace, depending on your video mode. Use SDL_UpdateRect instead.
I'm not really sure. I used SDL_ANYFORMAT and didn't do anything about HW & SW.
Okay let me just ask this, is there anyway I can adjust the format (Rmask, Gshift, ect...) without the surface slowing down? Using the surface as a BG layer btw.

This topic is closed to new replies.

Advertisement