double buffering, triple buffering
ok in my game I was using double buffering, but after I put sound in it slowed down when I went to go to another screen and scroll. So now I use triple buffering which works great for the scroll. But triple buffering on regular movement is sorta jerky. \
So how do I use only double buffering in a dx7 flip command, vs. the triple buffering?
Re: double buffering, triple buffering
Are you using time based movement?
Re: double buffering, triple buffering
yes for the character who i want to only be double buffered
Re: double buffering, triple buffering
Upload what you got. I'll see what's going on. But if the computer is going haywire and you hear annoying loading noises from your tower, then of course the time based movements gonna appear jerky because it's trying to jump back to where it is suppose to be and catch up to normal speed.
Re: double buffering, triple buffering
VB Code:
'get the screen surface and create a back buffer too
ddsd1.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
ddsd1.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_FLIP Or DDSCAPS_COMPLEX
ddsd1.lBackBufferCount = 2 '2 for triple buffering 1 for double buffering
Set primary = dd.CreateSurface(ddsd1)
'Get the backbuffer
Dim caps As DDSCAPS2
caps.lCaps = DDSCAPS_BACKBUFFER
Set backbuffer = primary.GetAttachedSurface(caps)
backbuffer.GetSurfaceDesc ddsd3
'then I write to the buffer like so
Sub RenderDrawThing2(TileSourcesurf As DirectDrawSurface7)
Dim r As RECT, retVal As Long
r.Left = 0
r.Top = 0
r.Right = 50
r.Bottom = 50
'This is where we copy the tile from the source to the destination
retVal = Mainsurf.BltFast(x * 50 - 50, y * 50 - 50, TileSourcesurf, r, DDBLTFAST_WAIT)
End Sub
'And I flip like so
Sub RenderBackBuffer()
Dim ddrval As Long
Dim rBack As RECT
ddrval = backbuffer.BltFast(0, 0, Mainsurf, rBack, DDBLTFAST_WAIT)
primary.Flip Nothing, DDFLIP_WAIT
End Sub
so my question again is how can I use double buffering sometimes and triple buffering sometimes throughout the program?
Re: double buffering, triple buffering