CreateOffscreenPlainSurface = D3DERR_INVALIDCALL???

Started by
6 comments, last by Mike737 19 years, 6 months ago
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);
Advertisement
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.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Changed to D3DPOOL_DEFAULT and still the same result. I tried increasing the debug output level from DirectX but its greyed out and is marked at the lowest (Think it may be due to developing with 9b and running 9c?)

Any other suggestions?
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?
Unfortunately I can't use 9c, due to assignment requirements which is a real pain
Ideas anyone?
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

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?

This topic is closed to new replies.

Advertisement