Archived

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

Omaha

LPDIRECT(whatever)

Recommended Posts

Ok, will somebody explain something to me... I've used DirectDraw in the past, but now I use OpenGL alot more... I've done a dash of DirectSound. I'm going to be using DirectInput in the near future. There's LPDIRECTx, LPDIRECTx3, LPDIRECTx7 for any given facet. Does each mean it offers what the particular version of the given facet for the version of DirectX given by the number? That always confused me, and in the two books I have on the subject as well as the different documentation I've checked it was never really explained really well, and it never got in my way with DDraw and DSound, so I just kind of pushed it into the "Things I don't know but hope they'll never sneak up on me" category of my mind. (add: I'm aware they're all pointers, yes, so please don't jump on me for not mentioning it) Edited by - Omaha on October 14, 2001 2:22:48 AM

Share this post


Link to post
Share on other sites
I''m not sure I understand your question, but if you''re wondering whether the version numbers on the interface names correspond to the version number of the DirectX version they first appeared in:

Nowadays the numbers correspond, e.g.
IDirectDraw7 appeared in DirectX 7; Direct3DDevice8 appeared in DX 8 etc...

It''s not true for older interfaces though, IIRC
IDirectDraw3 appeared in DirectX 5 or 6.

Share this post


Link to post
Share on other sites
I guess my question is, if I use, say, the following three declarations in my program:

LPDIRECTDRAW lpDDObject;
LPDIRECTSOUND lpDSObject;
LPDIRECTINPUT lpDIObject;

What versions and features am I getting? I''m linking to and including files from the DX8 SDK...

Share this post


Link to post
Share on other sites
Well, I havent programmed DirectX in C++ yet. But, I can tell you DirectDraw is not part of The DirectX8 API and has been replaced with Direct3D. So, even 2D images must be rendered with Direct3D. In conclusion 2D+Microsoft=3D then Head->upbutt; goto confused?

PS: In VB all the DirectX8 objects have 8 in their names.

Share this post


Link to post
Share on other sites
LPDIRECTDRAW lpddObject;
That would probably be the pointer to the first iteration of the directdraw interface, which isn't too helpful. As Rambo mentioned, dx8 doesn't support directdraw any longer, so for that at least your best bet would probably be to use the dx7 interface, ala:
  
if(FAILED(DirectDrawCreateEx(NULL, (void**)&lpdd7, IID_IDirectDraw7, NULL)))
{
fprintf(iParms->ELog, "Could not create dd7 interface\n");
return(0);
}


where lpdd7 was defined as LPDIRECTDRAW7 lpdd7...


Edited by - Muse on October 14, 2001 11:13:28 AM

Share this post


Link to post
Share on other sites
The components of DirectX use COM (Component Object Model) to manage object management and versioning. Each subsystem/component (such as DirectDraw, DirectSound etc) is composed of multiple objects (such as a DirectDraw surface, a DirectDraw clipper, a Direct3D vertex buffer etc).

As you know the LPblahblah is just a pointer to the interface of the object (think of a pointer to an instance of a class in C++).

With COM, when Microsoft want to add a new feature to a component they add a new version of an interface and give it a new number. Previous interfaces are still available (though it''s not advisable to mix versions from within the same component)

MS only recently started keeping the interface numbers the same as the SDK version. Before that it was a tad more confusing because you''d have things like an IDirectDrawSurface3 pointer with an IDirectDraw pointer etc.

You should use the newest interface available unless you have a good reason not to. (An example of a good reason would be if you needed to use DirectDraw with DirectX 8).

You should look in the DirectX SDK docs for more on how it uses COM etc. The location is something like:
DirectX 8.x (C++) ->
Introducing DirectX 8.x ->
Programming DirectX with C/C++ ->
Using COM
[The exact location may be different in your SDK, I only have a beta version of 8.1 on my home machine]

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

Share this post


Link to post
Share on other sites