Jump to content
  • Advertisement
Sign in to follow this  
amtri

Multiple LPDIRECT3D9 objects

This topic is 4170 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'm in the process of writing library functions that interface with Direct3D. However, it is possible that the user of these libraries has already instanced a Direct3D9 interface, and even created devices and set render states in it. Given that, I was wondering whether somebody could help me with some questions: 1) If my user has already created a Direct3D9 interface and is already controlling the screen with a LPDIRECT3DDEVICE9 object, is there any way I can find that out? 2) If that's the case, can I query Windows for this information? How? 3) If it's not possible to get this information, what are the implications of having multiple LPDIRECT3D9 and LPDIRECT3DDEVICE9 objects controlling the same device? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
To the best of my knowledge, there's no way to get the current device, or to determine if one has been created.
I don't really know what will happen if you try to create two devices on one window, I suspect the second one will just fail at the CreateDevice() call.

Surely if a user is using your library, it's their own fault if they've already got a device?

Share this post


Link to post
Share on other sites
Actually, this is quite possible. They may already have some graphics going on, but may want to use my library for some very specific action they don't want to deal with.

A good example would be they are writing a game but all they want from my library would be the ability to create a person with all its attributes to add to the game. In that case, I need to *fit in* their environment, rather than force one upon them.

At the same time, them may prefer to let me deal with ALL graphics issues. In this case, I would control all Direct3D objects from the start.

Thanks.

Share this post


Link to post
Share on other sites
So you need two varieties of init code. One which will create a device for them, and one which will take their device, and store it locally. The rest of the code just uses the device pointer, wherever it happened to come from.

Share this post


Link to post
Share on other sites
Namethatnobodyelsetook: thanks! I was wondering whether I would have to have them pass me the pointers, or whether I could just query Windows for it.

Looks like they have to pass it over to me :-(

Thanks again.

Share this post


Link to post
Share on other sites
Sign in to follow this  

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