Archived

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

Outcast

Any reason to not use D3DX?

Recommended Posts

Outcast    122
I remember when this came out (DX7??) there seemed to be some resistance to using these utility functions. Was their any reason for this? In DX9, is there still the distinction between immediate mode and retained mode (I believe those were the two modes). I''m learning right now, but some of the tutorials I''m using are based off of DX8, and I am trying to update the code as I go. SpaceCowboy

Share this post


Link to post
Share on other sites
Shock    140
Well, im also very new to direct3d atm, learning tho. So far ive only seen one thing wrong with using D3DX. I once used D3DXCreateTextureFromFileEx() and my .exe swelled up pretty big.
From 200k it went to 1.6mb :\ by using the function.

I havent had a chance to see how useful it could be, but that''s the only bad thing iv''e picked up so far. Well not bad, im not sure :\ Just dont like my .exe going so big for using one function. I guess maybe it included code for interpreting all its supported image file formats? No idea.

Shock

Share this post


Link to post
Share on other sites
RhoneRanger    100
quote:
Original post by Shock
I once used D3DXCreateTextureFromFileEx() and my .exe swelled up pretty big.
From 200k it went to 1.6mb :\ by using the function.



So all you changes was 1 function, and your program went up to 1.6 meg? *cough*


Anyway, with dx8 and 9 there is no more "immediate" and "retained" modes.

There is nothing wrong with d3dx, unless you want to be cross platform. It will be hard to gain performance by writing your own functions, but there are ways.

The resistance was a group of programmers creating the D3DX Library allowed people to not learn about vector and matrix math, but it still is a great lib.

Good luck to you Outcast!

Share this post


Link to post
Share on other sites
Doolwind    213
Please guys, try to only post things that you know are true, and if you are unsure don''t state it as fact.

DirectX is not cross-platform....and by adding that one function the .exe shouldn''t have blown up to 1.6meg, it must have been something else that did this.

D3DX is excellent and should be used as much as you need. Unlike glut used to be (not sure how the newer versions are) D3DX doesn''t have memory leak problems. Also, Microsoft likes to boast that a lot of its functions within D3DX (especially the math library''s) are highly optimized, although I haven''t tested this myself, it seems logical that they would be.

The only reason I don''t use it is when I want to fully understand what I am doing, and so I write the code myself, but this is purely from a learning perspective. The underlying thing here is that it is saving you from reinventing the wheel.

Doolwind

---------------------------------------------------------
Who of you by worrying can add a single hour to his life.
Matthew 6:27

Share this post


Link to post
Share on other sites
MichaelT    214
The performance of D3DX is much better than it used to be. Needless to say, D3DX is offering generalized solutions for things and this does have some performance impact by definition. However, the performance is much better than most people new to programming can achieve anyway. So I don''t see a problem using D3DX for performance reasons or otherwise. If you want a specialized solution for your project then you should only use the D3DX solutions that would be pretty much reinventing the wheel anyway.

Good luck

____________________________________________________________
Try RealityRift at www.planetrift.com
Feel free to comment, object, laugh at or agree to this. I won''t engage in flaming because of what I have said.
I could be wrong or right but the ideas are mine.

Share this post


Link to post
Share on other sites
superdeveloper    188
1) So what is an exe is larger due to 1 method. The EXE represents < 1% of the overall size of a game. Try to compile it in Release mode and THEN observe what happens to the exe size.

2) The d3dx method requires the d3dx library to load, so if you use 1 method, or ALL OF THEM, you only pay this size penalty just ONCE.

[edit] clarification & spelling

[edited by - superdeveloper on October 10, 2003 9:38:26 AM]

Share this post


Link to post
Share on other sites
Outcast    122
Cool, thanks for all the info. I''ve already studied both matrix and quaternion math, and I could write the modules myself, I''m the type of programmer that would rather use someone else''s optimized and tested code than write my own maybe faster, probably buggier versions until I see proof I need to do so. I''m glad they got rid of the distinction between retained and immediate mode. Eliminates a choice for someone learning DX. From what it sounds like, I can continue using D3DX without worrying about huge performance hits.

Thanks,

Outcast

Share this post


Link to post
Share on other sites
Muhammad Haggag    1358
D3DX is optimized for SSE, 3DNow!, and possibly SSE2. It''s vector, quaternion, and matrix functions aren''t general or anything - they''re the standard functions used in any engine.

If you''re not going for cross-platform support, use D3DX. Otherwise, use math libraries from intel and AMD (these are optimized for SSE and 3DNow) - in short, don''t write it yourself (except for learning, of course), it''s a waste of time.

Muhammad Haggag
MHaggag''s corner

Share this post


Link to post
Share on other sites
Swizzlestick    122
The latest SDK update has some pretty spiffy new high dynamic range lighting additions to D3DX, and while it''s still not necessarily in game-usable form, the pre-computed radiance transfer simulator is also very cool and way beyond the time it would be worth to figure out all the math that''s behind it to do it yourself (at least for math weaklings like me.)

Share this post


Link to post
Share on other sites
JoeyBlow2    100
There was some resistance in D3DX libs in the early days because there was a few bugs in it. If my memory is not failing me, the LookAtLH function would corrupt the matrix and not work correctly, but with DX8+ all the bugs are fixed.

Share this post


Link to post
Share on other sites
sporff    166
ya like a previous poster said.. there''s more to them than just multiplying matrices and stuff. a lot of the functions are highly optimized and take full advantage of hardware that one computer may have but another may not.

you should definitely know how to write your own code for the math operations D3DX encapsulates but D3DX is so optimized that it''s almost dumb to write all your own code. D3DX is very excellently written and easy to use.

Share this post


Link to post
Share on other sites