Jump to content
  • Advertisement

Archived

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

Bleakcabal

Should I program a wrapper around D3D

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

Hello, I am using some simple D3D in screenspace mode to do the equivalent of 2d ( with textured "squares" acting as sprites ). I immidialty began writing a class enclosed in it''s own .h and .cpp file and everything. But the more I program the more I ask myself, is it really worth it ? Is it really necessary to add another layer on the D3D ? The long stuff you often only have to do once in your program so whether you program it once in your class or once in your code it doesnt change much. And I often find myself doing "special cases" which are methods which are only used at one place in my code and I can''t put in the main file because all my objects are cleanly declared as protected in my class. On the other hand, Im used to OOP and know some of the benefits it can provide. Just by curiosity what do you all think about this and what do you do yourselves? WHO DO THEY THINK THEY''RE FOOLING : YOU ?

Share this post


Link to post
Share on other sites
Advertisement
It sounds like a nice idea, and indeed there might be some advantages for wrapping D3D (like a nicer, simpler interface that does JUST what you want). But D3DX (the utility library that comes with DirectX) already does a lot of stuff that a wrapper library would do. D3DX is well documented, and reletively bug free, and a lot of people know it.

If wou want to do some sort of general library type thing, try writing a sprite engine ontop of D3DX or something. D3DX wraps D3D, but doesn''t provide the full functionality of a sprite engine.

Share this post


Link to post
Share on other sites
I try to abstract as far as I can from D3D in my graphics engine to maximise the possibility of porting it to something like OpenGL at a later date. So this means that a lot of it is wrapped up in classes etc. For example I keep a sprite class with a virtual render function. I can then derive from this class and implement in D3D or OpenGL.

This also has the advantage that I can then alter the interface to the sprite class to suit my needs for the project. Plus it gives you a better understanding of what is going on.

Rory

Share this post


Link to post
Share on other sites
These are two very interesting awnsers on each side of the same coin. They made me think alot, I think for this project I might just stick to D3DX, and for later bigger projects, try to go as abstract as possible.

WHO DO THEY
THINK THEY''RE
FOOLING : YOU ?



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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!