DDERR_NODIRECTDRAWHW at CreateSurface

Started by
2 comments, last by Evil Steve 16 years, 9 months ago
hey, When I set my display to 1024x768x32 I works until I try to create an offscreen surface in video memory, thats when I get a DDERR_NODIRECTDRAWHW error. I have a Geforce2 MX 100/200 with 32mb. EnumDisplayModes() and the manual says the card can handle that mode and more, but GetCaps() returns DDCAPS_NOHARDWARE. So what is the Geforce doing? Here is the code to create the offscreen surface:

	
	memset(&ddsd, 0, sizeof(ddsd));
	ddsd.dwSize=sizeof(ddsd);
	
	ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;

	ddsd.dwWidth = this->width;
	ddsd.dwHeight = this->height;

        //mem_flag = DDSCAPS_VIDEOMEMORY in this case
	ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | mem_flag;

	retval = this->lpdd7->CreateSurface(&ddsd, &this->lpdds, NULL);

My program works perfectly in 1024x768x8 mode, so the error doesn't make any sense to me. Any thoughts? Thanks D
Advertisement
EnumDisplayModes() enumerates the display modes the device is capable of, it doesn't say anything about the surfaces it can create. It's probable that your card doesn't support hardware DirectDraw (I don't know of any cards that do).

It's been ages since I did DirectDraw, but is there not some other flag you need to pass to CreateSurface() to tell it you're crating a swap chain? I can't recall if I ever tried to tell DDraw to create a surface in hardware.
[EDIT]DDSCAPS_FLIP | DDSCAPS_COMPLEX looks promising[/EDIT]

Is there a reason you're using DDraw? It's pretty much unsupported in hardware, meaning you'll be doing all your rendering in software, which will be pretty slow. Even for 2D stuff, D3D is much prefered these days.
I can make the primary surface without errors, thats what the flip and complex flags are for right, only the primary surface?

Its when I make the offscreen surface for graphics that I get the error

I know I should be using D3D, and I've started reading about it. Its just this error bugs me because I don't know why I can make a primary but not an offscreen surface.
Quote:Original post by firstelder_d
Its when I make the offscreen surface for graphics that I get the error
Yup, because your card - like almost every card on the market - doesn't support DirectDraw in hardware. You have no choice but to create the surface in software, meaning all your drawing will be done on the CPU rather than the GPU. This is exactly why DDraw is no longer in use, practically nothing supports it.

Quote:Original post by firstelder_d
I know I should be using D3D, and I've started reading about it. Its just this error bugs me because I don't know why I can make a primary but not an offscreen surface.
Presumably DirectDraw is either ignoring the video memory flag because you're creating a swap chain, or there's some trickery going on under the hood to support this. Either way, I wouldn't expect amazing performance from it.

This topic is closed to new replies.

Advertisement