Well, the “problems” go as follows.
I have a PIII 866 256MB/RAM and GeForce 2 GTS 32MB.
-
- In the simple SDL window -
SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN flags, I load a picture…
- In the simple SDL window -
80060016:: I load 16-bit bmp format 800600 = 42fps!!!
80060016:: I load jpg file (same pic but jpeg)=30fps!!!
102476816::bmp 42fps!!!
1024768*32::bmp 40fps!!!
With jpeg… About 3-6 frames slower…
Why? And , it’s just one picture… What if I want to create a menu,
and/or game?? With moving sprites???
Why is it that slow??? I expected 200-300 fps… At least…
It’s a 2D graphics da*n!
Please, answer, I’m a newbie in graphics, so I don’t know too much:)
Well, to avoid any missunderstanding about my code… Here it is…:-------------------
#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>
#include “SDL_image.h”
#include “SoFont.h”
SDL_Surface *screen;
SDL_Surface *back;
SDL_Surface *tekst;
SDL_Event event;
bool quit=false;
Uint32 pst_frmrate=1;
Uint32 cur_frmrate=1;
Uint32 fin_frmrate=1;
double rfps;
int decimal, sign;
char *fps;
int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_VIDEO);
screen=SDL_SetVideoMode(1024,768,32,SDL_SWSURFACE|SDL_DOUBLEBUF|SDL_FULL
SCREEN);
back=IMG_Load(“gfx\game.bmp”);
Uint32 crno;
crno = SDL_MapRGB(screen->format, 0, 0, 0);
SoFont soFont;
tekst = IMG_Load("font\\arial_white_24.png");
soFont.load(tekst);
while (!quit) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_KEYDOWN: {
switch(event.key.keysym.sym) {
case SDLK_UP: {break;}
default:
{SDL_Delay(100); SDL_Quit(); exit(0); break;}
}
}
default : break;
}
}
//usual operations
cur_frmrate=SDL_GetTicks();
fin_frmrate=cur_frmrate-pst_frmrate;
pst_frmrate=cur_frmrate;
rfps=( (float)1000/(float)fin_frmrate) ;
fps=_fcvt(rfps,0,&decimal,&sign);
SDL_FillRect(screen,NULL,crno);
SDL_BlitSurface(back, NULL, screen, NULL);
soFont.PutString(screen,5,2,"FPS:");
printf("FPS: %s\n", fps);
soFont.PutString(screen,95,2,fps);
SDL_Flip(screen);
}
SDL_Delay(100);
SDL_Quit();
exit(0);;
}
Tonci Jukic