Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Raptor85

CreateTexture problems

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

now this one is ticking me off, and it''s probably something horribly simple too. to get right to the point, this fails if(FAILED(g_pd3dDevice->CreateTexture(Width,Height,1,0,D3DFMT_R5G6B5, D3DPOOL_MANAGED,&THandle.MipData.Texture,NULL))) { return NULL; } it compiles fine, and all data seems to be in the right format. It took me an hour just to sort through and find that it was this section failing! (debugging with the f11 key )

Share this post


Link to post
Share on other sites
Advertisement
In which way does it fail?

If D3D is returning a failure error code, then you should use the debug D3D runtime with the debug level turned up to enable D3D to tell you the reason for any problems.

1) Install debug D3D runtime (you get the option when installing the SDK)

2) Enable debug runtime in the DirectX control panel applet.

3) Increase D3D debug output level in DirectX control panel applet.

4) Run your program. If single step debugging, hit F10 to step over rather than into.

5) Look at the debug output window. If the call failed, D3D will tell you in there. More importantly though it''ll tell you *WHY* it failed.


There could be a number of reasons WHY creating a texture fails:

- the parameters you pass into the function are invalid.

- a problem with the dimensions (not power of 2 and/or not square on hardware that requires it - some does).

- a problem with the size (cards do have minimum and maximum sizes - on some [mainly older chips] the range can be as small as 16x16 to 256x256).

- a problem with the format (not supported by the hardware etc).

- not enough available memory to create the texture

- a problem elsewhere - lost device etc.

...etc...



--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
You might want to consider using D3DXCreateTexture.. it will always attempt to succeed, even if it needs to alter your parameters slightly to meet device capabilities.

xyzzy

Share this post


Link to post
Share on other sites
i know about how to use debug, but thanks anyways.

i found my problem, i had to reinstall directx (i only found it out when i realized that when i try to edit the settings in the control panel, they stay the way they were, that''s why i wasnt getting debug output)
i think it''s this stupid netgear network card, my system has acted funny ever since i installed it, and if i unplug it, everything works normally!
again, thanks anyways.

Share this post


Link to post
Share on other sites

  • 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!