IERRSTRING ("DirectDraw", IDirectDraw7_SetDisplayMode (pSDO->pDevice, pDDSD->dwWidth, pDDSD->dwHeight, pDDSD->ddpfPixelFormat.dwRGBBitCount, 0, 0));
INITIALDXSTRUCT (pSDO->Caps);
IERRSTRING ("DirectDraw", IDirectDraw7_GetCaps (pSDO->pDevice, &(pSDO->Caps), NULL));
INITIALDXSTRUCT (ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.dwBackBufferCount = 1;
if (pSDO->Caps.dwVidMemFree>=(pDDSD->dwWidth*pDDSD->dwHeight*(pDDSD->ddpfPixelFormat.dwRGBBitCount>>3)))
{
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP |
DDSCAPS_COMPLEX |
DDSCAPS_VIDEOMEMORY;/* |
DDSCAPS_LOCALVIDMEM;*/
}
else
{
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP |
DDSCAPS_COMPLEX;
}
IERRSTRING ("DirectDraw", IDirectDraw7_CreateSurface(pSDO->pDevice, &ddsd, &pSDDB->Primary, NULL));
INITIALDXSTRUCT (pSDDB->Desc);
IERRSTRING ("DirectDraw", IDirectDrawSurface7_GetSurfaceDesc (pSDDB->Primary, &pSDDB->Desc));
memset (&caps, 0, sizeof (caps));
if (pSDO->Caps.dwVidMemFree>=(pDDSD->dwWidth*pDDSD->dwHeight*(pDDSD->ddpfPixelFormat.dwRGBBitCount>>3)))
caps.dwCaps = DDSCAPS_FLIP | DDSCAPS_COMPLEX | DDSCAPS_BACKBUFFER | DDSCAPS_VIDEOMEMORY/* | DDSCAPS_LOCALVIDMEM*/;
else
caps.dwCaps = DDSCAPS_FLIP | DDSCAPS_COMPLEX | DDSCAPS_BACKBUFFER;
IERRSTRING ("DirectDraw", IDirectDrawSurface7_GetAttachedSurface(pSDDB->Primary, &caps, &pSDDB->Buffer));
The code creates a direct draw primary surface with an attached buffer surface.
The strange problem is that sometimes the buffered surface is created with a different resolution then the primary surface.
The screen would flip from one resolution surface to a different resolution surface.
Directdraw wont allow to creat primary surface with the width and height specified at the DDSURFDESC2.
Do you have any idea what can cause this?
I would appreaciate help on this matter.
Strange DirectDraw problem
I use the following code
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement