LPDIRECTDRAWSURFACE surface = NULL;
// Clear the ddsd memory
EraseDesc();
ZeroMemory( &ddsd, sizeof( ddsd ) );
ddsd.dwSize = sizeof( ddsd );
// Fill in the surface info
ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT;
ddsd.dwWidth = width;
ddsd.dwHeight = height;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY;
// Create the surface
long rval = lpdd->CreateSurface(&ddsd, &surface, NULL);
if (rval != DD_OK)
{
MessageBox(hwnd, "Failed to create offscreen surface", "Error", MB_OK);
quit = true;
}
return surface;
The rval that is returned is: -2147024809 which is not a valid DX error code so that isn't helping.
Anyone have an idea what might be causing the function to fail?
Cheers!
DirectDraw - CreateSurface for offscreen surface fails
Hey,
I'm just trying out a DirectDraw tutorial as I need to create a 2d game quickly in order to exemplify some networking code I have. However, I have a problem when I call a function to create an offscreen surface - the call to CreateSurface() always fails.
Here's my code:
Quote:Original post by gazsux
Hey,
I'm just trying out a DirectDraw tutorial as I need to create a 2d game quickly in order to exemplify some networking code I have. However, I have a problem when I call a function to create an offscreen surface - the call to CreateSurface() always fails.
Here's my code:LPDIRECTDRAWSURFACE surface = NULL; // Clear the ddsd memory EraseDesc(); ZeroMemory( &ddsd, sizeof( ddsd ) ); ddsd.dwSize = sizeof( ddsd ); // Fill in the surface info ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT; ddsd.dwWidth = width; ddsd.dwHeight = height; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY; // Create the surface long rval = lpdd->CreateSurface(&ddsd, &surface, NULL); if (rval != DD_OK) { MessageBox(hwnd, "Failed to create offscreen surface", "Error", MB_OK); quit = true; } return surface;
The rval that is returned is: -2147024809 which is not a valid DX error code so that isn't helping.
Anyone have an idea what might be causing the function to fail?
Cheers!
-2147024809 is E_INVALIDARG error code.
I don't know, but don't see any color depth setting.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement