help with LPDIRECT3DDEVICE9

Started by
3 comments, last by th3matr1x 18 years, 9 months ago
is there a way to copy an LPDIRECT3DDEVICE9 to another device?
I love programming
Advertisement
Why? What do you intend to do? Please explain a bit more.
Try, try and fucking try again.
Quote:Original post by Talib
Why? What do you intend to do? Please explain a bit more.


I dunno if it's the best method to do it, but this is my problem:

I want to load textures in realtime, so i used the thread technique.
so when the user presses a button i start the loading texture thread with :
AfxBeginThread(....);
after trying this method i figured out a problem of syncronisation due to the use of :
LPDIRECT3DDEVICE9 m_pd3dDevice
so i thought i would just copy my m_pd3dDevice to another one then when the thread has finished loading the texture i copy the new one to the old one.

I think it's not the best method of doing it, but i coulden't find any help on the net.

could you help?
I love programming
Still not quite sure of what you mean by copying a m_pD3DDevice to another one and then copy the new one to the old one.

A LPDIRECT3DDEVICE9 is an interface to a specific rendering device. Certain methods of both IDIRECT3D9 and IDIRECT3DDEVICE9 must be handled by the same thread that handles the Windows message pump (including creating devices). Creating more than one interface to a device wouldn't solve this issue.

Creating a multi-threaded application isn't an easy journey, especially when you add APIs like D3D and OGL.

When you create a IDIRECT3DDEVICE9 through CreateDevice, are you specifying the D3DCREATE_MULTITHREADED flag as well? It states that D3D9 should be required to be multi-threaded safe, which means it takes control of its global critical section more frequently and can degrade performance. (from the D3D9 sdk)
Quote:Original post by sordid
Still not quite sure of what you mean by copying a m_pD3DDevice to another one and then copy the new one to the old one.

A LPDIRECT3DDEVICE9 is an interface to a specific rendering device. Certain methods of both IDIRECT3D9 and IDIRECT3DDEVICE9 must be handled by the same thread that handles the Windows message pump (including creating devices). Creating more than one interface to a device wouldn't solve this issue.

Creating a multi-threaded application isn't an easy journey, especially when you add APIs like D3D and OGL.

When you create a IDIRECT3DDEVICE9 through CreateDevice, are you specifying the D3DCREATE_MULTITHREADED flag as well? It states that D3D9 should be required to be multi-threaded safe, which means it takes control of its global critical section more frequently and can degrade performance. (from the D3D9 sdk)


you are da man !! it's working properly now . thumbs up m8.
I love programming

This topic is closed to new replies.

Advertisement