DirectDraw Blt slowing down windows?

Started by
10 comments, last by stranger4u 21 years, 8 months ago
Hi there, I''m using lpDDSFrontBuffer->Blt( &rcWindow, lpDDSBackBuffer, NULL, DDBLT_WAIT, NULL ); to blit the backbuffer into the frontbuffer of my windowed game. But that slows down windows. When I move the mouse cursor it''s jumping around. How is that possible? I just call the above Funktion in the main game loop. Do I call it too often?
Advertisement
More information:

I rewrote my application to use ddutil.h for all the DirectDraw stuff. But the problem remains. Mouse is jumping, windows slows down. I still don''t understand why.
Why do you need to blit the backbuffer to your front buffer? Why not just call

lpDDSFrontBuffer->Flip(NULL,DDFLIP_WAIT);

that flips the backbuffer to the front buffer (presuming you got your backbuffer as an attached surface of lpDDSFrontBuffer)

If you have any more problems post your code that you use for setting up directdraw.

=*=
If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore

=*=
Because he''s in window-ed mode, and you can''t do page-flipping in window-ed mode!!

I''m doing something that runs in window-ed mode, I''d be interested to find out if you find what is causing this problem. How many frame per second are you getting btw??

JJ.
I can''t flip because I''m not using full screen mode. It''s just a window in which I''d like to draw. It works, but the slowdown is very weird.

The code I use is:

Display.Clear(0);
Display.Blt( 0, 0, SurfaceNormalBlocks, 0);
Display.Present();

Display is of the type CDisplay (from ddutil.h), SurfaceNormalBlocks contains just a bitmap that I want to display on the screen.

The code works fine, the bitmap gets drawn, but still the slowdown occurs.
I think your app slows windows down because you did not include a framerate limit or do not render only on WM_PAINT.
At least I had this kind of problem.
Im Anfang war die Tat...Faust
quote:Original post by Jiim
Because he''s in window-ed mode, and you can''t do page-flipping in window-ed mode!!

I''m doing something that runs in window-ed mode, I''d be interested to find out if you find what is causing this problem. How many frame per second are you getting btw??

JJ.


I don''t know, I don''t calculate the fps. This is my first game anyways so right now I''m just trying get something on screen. And that works.. If I manage to get rid of the slowdown everything is alright. IF.
quote:Original post by Hippokrates
I think your app slows windows down because you did not include a framerate limit or do not render only on WM_PAINT.
At least I had this kind of problem.


That sounds interesting. No I don''t have a limit, I just Blit everytime the mainloop is running. So that''s causing the slowdown? Really interesting, will try to limit it. Thanks.
Alright, limiting the fps helps. Thanks a lot.
I had a similar problem when my main loop wasn''t taking long enough and was able to solve the problem by inserting Sleep(0); at the end of my main loop which gives windows a chance to update the mouse.

This topic is closed to new replies.

Advertisement