Skip to main content
GameDev.net gamedev.net
🔒 Locked

Should I program a wrapper around D3D

Started by Bleakcabal May 30, 2002 at 7:57 PM 2 replies 200+ views
Original Post
Bleakcabal
Bleakcabal
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 ?
WHO DO THEYTHINK THEY'REFOOLING : YOU ?
SH
SH
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.
-- SH
ProtoPornoPants
ProtoPornoPants
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
Bleakcabal
Bleakcabal
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 ?



WHO DO THEYTHINK THEY'REFOOLING : YOU ?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.