is threre no way to regulate 'buzzing frames' without 'delta time'?
Members - Reputation: 106
Posted 08 December 2012 - 10:33 PM
thanks for all the person answers my question,
however, there is no way to regulate 'buzzing frames' without 'delta time'?
because, i want that if the framerate is low, game processing (ex. bullet moving) is have to slowed.
in my game, when Start Game Screen Surface with SDL_FULLSCREEN | SDL_SWSURFACE, 'sprite buzzing' occured.
however, SDL_FULLSCREEN | SDL_HWSURFACE, | SDL_DOUBLEBUF 'sprite buzzing' problems are solved.
but, there are two problems about SDL_FULLSCREEN | SDL_HWSURFACE, | SDL_DOUBLEBUF.
first. SDL_HWSURFACE | SDL_DOUBLEBUF mode are not applied when Window mode.
second, Alpha Blending is very slow when SDL_FULLSCREEN | SDL_HWSURFACE, | SDL_DOUBLEBUF.
so, my question is..
1. is there no way to regulate 'buzzing frames' without 'delta time'?
2. how to enable 'SDL_HWSURFACE | SDL_DOUBLEBUF' in window mode?
3. why the alpha blendings are slowed when 'SDL_HWSURFACE | SDL_DOUBLEBUF' are enabled?? how to solve this??
my development environment is ms windows 7, ms visual studio 2010,
sdl 1.2 and 'sdl_putenv(sdl_videodriver=directx)'
Members - Reputation: 341
Posted 08 December 2012 - 11:20 PM
2) How did you checked if the flags SDL_HWSURFACE and SDL_DOUBLEBUF were applied? I always used those flags together and never got the "sprites buzzing" problem.
3) Post the code that apply alpha blending to the images, then I can try help you.
Crossbones+ - Reputation: 1391
Posted 09 December 2012 - 12:58 AM
Is it sprites moving a inconsistent speeds - that seems to be what most people understood from your previous post? In which case you would need to account for the frame time in order to fix it. Perhaps the reason SDL_FULLSCREEN | SDL_HWSURFACE, | SDL_DOUBLEBUF 'fixes' your problems is because vsync is also implicitly being applied. This means that your title is being automatically locked to your monitor refresh rate (probably 60hz) and so is running at a much more consistent rate. You could emulate the same effect without those flags if you limited your frame rate manually by measuring how long your frame took, then sleeping for an amount that brings your frame time up to approximately the 16.66 millisecond mark.
However, when you say sprite buzzing, do you mean that your sprites flicker, leave trails and move backwards and forwards rapidly sometimes? If that is the case, then perhaps all you're missing is a screen clear (glClear if you're using OpenGL). The fact you mention the speed of alpha blending makes me believe this could be the case.
(EDIT: In fact, it occurs to me that maybe you're deliberately skipping the screen clear in order to create a motion blur style effect. If this is the case, then unfortunately you need to use a different approach. In general you should consider the state of the frame-buffer at the start of a new frame to be full of random junk. In practise, the random junk in the frame buffer is usually an old frame, typically the one before last, but you should never assume that is reliably the case.)
Edited by C0lumbo, 09 December 2012 - 01:34 AM.
Members - Reputation: 341
Posted 09 December 2012 - 02:29 AM
It's hard to notice it when you are using sprites and the application screen is setted to resolutions bigger than 800x600.