PDA

View Full Version : PLease help DirectDraw and GAPI


Harry
01-16-2008, 10:27 AM
On a WM6 device why would DirectDraw and GAPI return different addresses for the screen memory.

If I use GAPI:
BYTE * pVideoMemory = (BYTE *)GXBeginDraw();
then pVideoMemory = 0x51b00000

but if I use DIRECTDRAW:
BYTE * pVideoMemory = (BYTE *)ddsd.lpSurface;
then pVideoMemory = 0x51a00000.


On a WM5 device the DIRECTDRAW method returns the same address as the GAPI method and my function used to draw to screen works.

Has it something to do with back buffers....


The below code is how Iset up my directdraw surface:

HRESULT hRet;
hRet = DirectDrawCreate(NULL, &g_pDD, NULL);

// Get exclusive mode

hRet = g_pDD->SetCooperativeLevel(this->m_hWnd, DDSCL_FULLSCREEN);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
ddsd.dwBackBufferCount = 1;


hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSPrimary, NULL);



Thanks for any help,


Harry

Goz
01-19-2008, 03:30 PM
Its not retunring you a physical memory address ... Windows can return you what ever address it wants and then just internally map it to the real physical address. They are 2 different APIs with, probably, 2 different drivers ... they may well map the memory differently.

If it works i wouldn't let it bother you, tbh.

Nils Pipenbrinck
01-20-2008, 04:11 AM
I suggest you ask such stuff over at pocketmatrix.com

The forum might seems to be dead, but it's not. Lots of WM and CE experts are lurking there.