Jump to content
  • Advertisement
Sign in to follow this  
Xero-X2

Device-CreateTexture failing

This topic is 4849 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

Im getting D3DERR_INVALIDCALL returned when attempting HRESULT hr = Device->CreateTexture( 512, 512, 0, 0, D3DFMT_R8G8B8, D3DPOOL_MANAGED, & Texture, 0 ); Texture remains NULL and the function failies, I can't seem to find out what im doing wrong, prolly is a real simple mistake, thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Hi there Xero-X2,

[The problem]
You are getting D3DERR_INVALIDCALL,
This means it is most probably that you are passing an invalid parameter.

[The solution]
I see you are passing 0 as the USAGE parameter.
You need to specify a parameter in the D3DUSAGE enumeration.

You might want to try and place the texture in the D3DPOOL_DEFAULT. What does this mean?
D3DPOOL_DEFAULT
"Resources are placed in the memory pool most appropriate for the set of usages requested for the given resource."

I hope this helps a bit.
Stay cool

Share this post


Link to post
Share on other sites
I tried your suggestion,
HRESULT hr = Device->CreateTexture( 512, 512, 0, D3DUSAGE_AUTOGENMIPMAP, D3DFMT_R8G8B8, D3DPOOL_DEFAULT, & Texture, 0 );

My results are exactly the same,

I believe that the DirectX Sdk states that usage can be 0,
Quote:
"Usage [in] Usage can be 0, which indicates no usage value. However, if usage is desired, use a combination of one or more D3DUSAGE constants. It is good practice to match the usage parameter with the behavior flags in IDirect3D9::CreateDevice. "

Share this post


Link to post
Share on other sites
Many cards don't support R8G8B8. Try X8R8G8B8 or A8R8G8B8 instead. In general you should use CheckDeviceFormat() to see if a format is available. A few formats, such as both 32-bit formats I listed above, are so universal you can probably get away with not checking for them.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!