May 5th, 1999, 12:05 PM
Is it possible to do decent flicker free animation using the win32 gdi functions ?
|
Click to See Complete Forum and Search --> : Animation using GDI May 5th, 1999, 12:05 PM Is it possible to do decent flicker free animation using the win32 gdi functions ? R.K.M. May 5th, 1999, 01:26 PM Of course.... Use offscreen bitmaps and then use BitBlt synchronized to the retrace (blanking pulse). To do this you need to use DirectX BUT DON'T PANIC, you are not going to use all of it. You don't have to use page-flipping, you don't have to set a display mode. All you need is to get an IDirectDraw object, nothing more. This is just like you are not using DirectDraw at all. In an IDirectDraw object you will find three functions: GetVerticalBlankStatus WaitForVerticalBlank GetCurrentScanline If you do the "wait" and then blit to the screen you will not see any flickering. May 5th, 1999, 01:33 PM You can get it pretty smooth using GDI and memory dc's. Check out this site for an example: http://members.xoom.com/zbonham/source.htm May 6th, 1999, 12:51 PM I checked the example but it still flickers. On his example, it looks like it doesn't flicker but that's because the images are very small and they are in black and white. The problem is with the vertical retrace. You have to be in sync with it. May 6th, 1999, 01:14 PM hmm... Is it possible that the "flickering" is due to the choppyness of the frames? I have a 133 and a 400 that I have run this on and I don't notice the "tearing" (at least in regards to what I would see under DOS). If the frames had a smoother transition from one frame to the next, I believe it wouldn't "flicker". I don't have enough images (or a way to generate them) at the office to check. FYI, the images are 256 color bitmaps. I would agree, that it probably could be smoother (more frames would help accomplish this), and syncing with the retrace would be a good start. Your right in the only way I know how to do that is under DirectX. Thanks for taking a look at it! May 6th, 1999, 02:20 PM Try it with bigger images and colors. Although you are using 256 color images, they don't have any colors. I tried it with other images and it flickers. I just modified it to wait for vertical retrace and it doesn't flicker anymore. Any examples on using transparency to blit images ? (without directx) May 7th, 1999, 01:49 PM >>Although you are using 256 color images, they don't have any colors. >>I tried it with other images and it flickers I hadn't tried that, thanks for the input! I don't have any source for a transparent blt, sorry. I have seen references on the net, but don't really remember where at the moment. If you are programming for win98 or nt 5.0, I think there is a new blt function called TransparentBlt that is available, but I haven't tried it. Thanks! Leonard Schreur July 12th, 1999, 02:35 AM Hi, Why don't you just wait for a vertical retrace? Billy G. say's you can't read/write the hardware directly under Windows 9x, until you try it!!! void WaitVR() _asm { mov dx, 03DAh L10: in al, dx test al, 8 jnz L10 L20: in al, dx test al, 8 jz L20 } } Just stick this one into your code and call it before you're swapping you backbuffer. Just to things about this: It doesn't run under NT and the higher you're screen resolution is the longer it takes before a vertical retrace occurs :) codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |