Re: Rapid gfx display Qs
- From: "Jim Mack" <jmack@xxxxxxxxxxxxxxx>
- Date: Sun, 18 May 2008 15:50:00 -0400
Schmidt wrote:
"Jim Mack" schrieb...
It's my understanding that using a flipping chain with 2
backbuffers can eliminate the need to delay updates
while waiting for the VBlank to flip.
If you fiddled that out, then I would be interested in your
results (the "flipping-code") - haven't played around with
that DX-stuff yet.
To use flipping -- I haven't tried triple-buffering yet -- is actually
a bit easier but less flexible. Speed seems about the same here.
Since all I care about is full-screen, I simplified your DxInit as
follows, and pass in the Form hwnd...
'======================
'
Public Function DxInit(hWnd as Long) As String
Dim PD As DDSURFACEDESC2
Dim BCaps As DDSCAPS2
On Error Resume Next
Set objDX = New DirectX7
Set objDD = objDX.DirectDrawCreate("")
' ** moved from below
'
BlthWnd = hWnd
' ** must have exclusive / fullscreen to flip screen?
'
objDD.SetCooperativeLevel BlthWnd, _
DDSCL_FULLSCREEN Or DDSCL_EXCLUSIVE
'define the primary surface
' ** add BACKBUFFERCOUNT flag
'
PD.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
' ** add FLIP and COMPLEX caps
'
PD.ddsCaps.lCaps = _
DDSCAPS_PRIMARYSURFACE _
Or DDSCAPS_FLIP _
Or DDSCAPS_COMPLEX
' ** ask for a backbuffer surface
'
PD.lBackBufferCount = 1
' ** Because BACKBUFFERCOUNT = 1, this also attaches
' a second matching surface which we'll get later
'
' In theory, setting it =2 gives triple-buffering
'
Set PSrf = objDD.CreateSurface(PD)
' ** this replaces all other OSrf setup
'
BCaps.lCaps = DDSCAPS_BACKBUFFER
Set OSrf = PSrf.GetAttachedSurface(BCaps)
If Err Then DxInit = GetErrString(): Err.Clear
End Function
'======================
'
' Also, the Blt() function now reduces to:
'
'
Public Function Blt(Optional ByVal WaitForSync As Boolean) As String
PSrf.Flip OSrf, DDFLIP_WAIT ' I always wait.
'
' It isn't clear that this actually waits here,
' or threads and continues...?
End Function
.
- Follow-Ups:
- Re: Rapid gfx display Qs
- From: Schmidt
- Re: Rapid gfx display Qs
- References:
- Rapid gfx display Qs
- From: Jim Mack
- Re: Rapid gfx display Qs
- From: Larry Serflaten
- Re: Rapid gfx display Qs
- From: Jim Mack
- Re: Rapid gfx display Qs
- From: Schmidt
- Re: Rapid gfx display Qs
- From: Jim Mack
- Re: Rapid gfx display Qs
- From: Schmidt
- Re: Rapid gfx display Qs
- From: Schmidt
- Re: Rapid gfx display Qs
- From: Jim Mack
- Re: Rapid gfx display Qs
- From: Schmidt
- Re: Rapid gfx display Qs
- From: Jim Mack
- Re: Rapid gfx display Qs
- From: Schmidt
- Rapid gfx display Qs
- Prev by Date: Re: Rapid gfx display Qs
- Next by Date: Re: Rapid gfx display Qs
- Previous by thread: Re: Rapid gfx display Qs
- Next by thread: Re: Rapid gfx display Qs
- Index(es):