Hi 2 all. I have a lame question about syncro in warp3d. I using voodoo3/aos3.9/m68k and want to do some truecolor animation. So:
I draw 640x480x32bit picture on screen (this picture = 6 textures), and try to scroll on this picture some sprite (128x512x32) with transparency. So, if i just move sprite (witchout redrawing some areas (textures) of my backscreen) it work nice with WaitTOF() only. BUT. If i moving sprite, and trying redrawing part of backscreen (two 256x256 textures), (do it animation i mean), i have some bugs on screen. Not big bugs, but some UPpers areas of my screen is 'blinking'. If i drawing in 'low' part of screen, it is work fine.. I don't know what is it, maybe problem with WaitTOF() or need do it somethink else ..
Well, next, i read some docs (graphics/intuition/warp3ddev), and found some worlds about 'double buffering'. It is allow to me rendering all data to 'invisible' scren, and flip with 'main' screen. But i do not understand HOW it can be help me. If WaitTOF() can't do it good synchro, how buffer fliping can give me good synchro ?
So, if i understand correctly, double-buffering can solve my 'some blinking UPpears areas'. (i am right?) And as i reading, here is 2 ways for it :
1. ScreenBuffer (alloc/change/free).
2. ScrollVPort + WaitBOVP.
Well, i just to try this code (only for 'flip' picture from 'invisibli' part, to 'main' part):
// ... create screen/window/warp3d context ...
vp=screen->ViewPort;
// draw to 'invisibli' screen.
W3D_SetDrawRegion(context,bm,480,&s);
vp->RasInfo->RyOffset=0;
ScrollVPort(vp);
WaitBOVP(vp);
W3D_SetScissor(context, &s);
// draw my pict, to 'invisibli' buffer, and do it some wait.
draw_pict(context,1.0f);
Delay(10);
// flip to 'main' screen
W3D_SetDrawRegion(context,bm,0,&s);
vp->RasInfo->RyOffset=0;
ScrollVPort(vp);
WaitBOVP(vp);
W3D_SetScissor(context,&s);
And nothink to happened .. Picture was drawing on 'invisibly' part, and can't flip.
Next, i try to use ScreenBuffers:
// creating 2 ScreenBuffer. 'main' and 'invisible'.
if(!(buf1=AllocScreenBuffer(screen, NULL, SB_SCREEN_BITMAP)))
{ printf ("failed to allocate screenbuffer\n"); goto panic;};
if(!(buf2=AllocScreenBuffer(screen, NULL, SB_SCREEN_BITMAP)))
{ printf ("failed to allocate screenbuffer2\n"); goto panic;};
// BitMap for Warp3d context creating
buf1->sb_DBufInfo->dbi_SafeMessage.mn_ReplyPort = NULL;
bm = buf1->sb_BitMap;
context = W3D_CreateContextTags(&CError,
W3D_CC_MODEID, ModeID,
W3D_CC_BITMAP, bm,
W3D_CC_YOFFSET, 0,
W3D_CC_DRIVERTYPE, W3D_DRIVER_BEST,
W3D_CC_FAST, TRUE,
W3D_CC_DOUBLEHEIGHT, TRUE,
TAG_DONE);
// ... skip some setstates/etc ...
for(i=250;i>0; i-=5)
{
ChangeScreenBuffer(screen,buf2); // draw to invisible buffer
Draw_Sprite(context,i);
ChangeScreenBuffer(screen, buf1); // flip ScreenBuffers.
};
And agayn, i have not a good synchro ;(
Well, here is questions:
1. Where best way for work with synchro on warp3d. If anyone have some sources it is will be very good.
2. How do it normal hi-rez animation on warp3d.
Any docs/link/sources/talks/help will be very good.
sorry for poor english, hope anyone can help me with it, thanks.