Jump to content
  • Advertisement
Sign in to follow this  
Mike737

CreateOffscreenPlainSurface = D3DERR_INVALIDCALL???

This topic is 4960 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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);

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!