🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Smooth days are gone?

Started by
2 comments, last by Stefpet 24 years, 9 months ago
If you've ever played any game on Windows, you know smooth animation is possible. The question is just how it's done.

Is your demo running in windowed mode, or fullscreen? If it's in fullscreen, then getting smooth animation is easy. You just have to create a back buffer, blit to that instead of the primary surface, and then flip it. DirectX will make sure the flip happens during the vertical refresh.

In windowed mode, it is a little bit more difficult, because you can't use the built-in back buffer and flip method. It sounds like you are already using the most common approach except for one thing. You said you are swapping the secondary buffer with the primary one, and I don't think that's possible with DirectX, so are you using GDI instead? If so, that's probably your problem.

You can find sample code to do what I have just described in a number of places, but if you can't find it or still need help, I can post some here.

[This message has been edited by Myopic Rhino (edited September 08, 1999).]

Advertisement
>> You said you are swapping the secondary buffer with the primary one, and I don't think that's possible with DirectX, so are you using GDI instead? <<

This is quite possible using DirectX. It's what is done whenever you call the flip method of a surface with a backbuffer. Technically, it's not swapping the memory between the two surfaces, but instead swapping the pointers to the memory. A much faster operation than actually copying one surface into another.

Hi all!

First a little about me... I've just recently started with VC++ and DirectX in Windows. So in that matter I'm a newbie. However, years ago I was into doing demo stuff on the Amiga and the C64. In assembly. In Windows I've just fooled around doing small games in Delphi.

Anyway, with my roots on the Amiga I'm used to smooth scrolling things. I started out doing a little textscroller in VC++/DirectX to learn a little, and I thought I could apply the same techniques from the old days. However, the results is not what I expected. Things are flickering, twitching and not even close to smooth. :-(

So I'm wondering, what am I doing wrong. What have I missed?

Basically I set up the screen and stuff, a clipper rect for the whole screen, and load the bitmapped font into memory.

The main loop then consist of first increasing different variables to know where to put the chars, then blitting the pieces of the bitmap on various positions in a second screen buffer, waiting for the rastersync, and then swapping the screen buffer to display this. I'm also using a timer which get the current tick count in the beginning of the loop, and wait until it reaches a certain value at the end of the loop before checking the rastersync and doing the buffer swap.

Well, the result is jerky. I don't want it to be. Any advice would be very much appreciated. Thanks.

quote: This is quite possible using DirectX. It's what is done whenever you call the flip method of a surface with a backbuffer.

Well, I KNOW that. But it sounds like he is actually swapping the surfaces, which can't really be done without breaking some rules.

quote: Technically, it's not swapping the memory between the two surfaces, but instead swapping the pointers to the memory. A much faster operation than actually copying one surface into another.

Yep, technically swapping is not the same as flipping, which is why I said it can't be done, and yep, it's faster, which is why I said it is what he should do.

This topic is closed to new replies.

Advertisement