Skip to main content
GameDev.net gamedev.net
🔒 Locked

CreateOffscreenPlainSurface = D3DERR_INVALIDCALL???

Started by Mike737 Oct 24, 2004 at 12:38 AM 6 replies 5.7k views
Original Post
Mike737
Mike737
When I try to run the following lines of code I recieve a HRESULT of D3DERR_INVALIDCALL. How can I fix this?

LPDIRECT3DSURFACE9 m_pHeightData;
HRESULT hr;

m_pHeightData = NULL;
hr = CreateOffscreenPlainSurface(256,256, D3DFMT_R8G8B8, D3DPOOL_MANAGED, &m_pHeightData, NULL);
circlesoft
circlesoft
D3DPOOL_MANAGED is not allowed when creating an offscreen plain surface. You should be using D3DPOOL_DEFAULT in most cases. When you're wondering why a D3D function fails, check out the debug output. It almost always leaves you with precise information about the failure.
PlayfulPuppy
PlayfulPuppy
If it's an option, I'd probably suggest getting the 9c SDK and see if you can change the output level then.

Without it you're probably going to be hard-pressed finding out exactly what the problem is. Are there any problems getting the 9c SDK?
S1CA
S1CA
I suspect the surface format you're asking for may not actually be supported by your graphics hardware/driver (24-bit modes aren't good for most hardware, try X8R8G8B8).

As has already been suggested, use the DEBUG Direct3D runtime (see the FAQ) to determine *why* D3D has returned the INVALIDCALL error. You don't need to have DirectX 9.0c to do this - you just have to have the DirectX SDK installed.
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
Mike737
Mike737
Quote:
Original post by S1CA
I suspect the surface format you're asking for may not actually be supported by your graphics hardware/driver (24-bit modes aren't good for most hardware, try X8R8G8B8).


Yep, that was the problem. Thanks!

Quote:
As has already been suggested, use the DEBUG Direct3D runtime (see the FAQ) to determine *why* D3D has returned the INVALIDCALL error. You don't need to have DirectX 9.0c to do this - you just have to have the DirectX SDK installed.


How can I turn on the Debug runtime without access to the Direct X Control Panel (from the windows control panel) if it isn't there? And VS.NET won't allow me to adjust the settings as they are greyed out?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.