Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having a small issue with D3DXVec3Unproject. I'm currently using Direct3D 11 and not 10, and the signature for this function is:


As you may have noticed, it requires a D3D10_VIEWPORT, and I'm using a Direct3D 11 viewport, D3D11_VIEWPORT.

Do you have any ideas how I can use D3DXVec3Unproject with Direct3D 11?

share|improve this question
up vote 6 down vote accepted

Instead of D3DXVec3Unproject() use XMVector3Unproject(). It accpet float parameters for viewport:

XMVECTOR XMVector3Unproject(
  [in]  XMVECTOR V,
  [in]  float ViewportX,
  [in]  float ViewportY,
  [in]  float ViewportWidth,
  [in]  float ViewportHeight,
  [in]  float ViewportMinZ,
  [in]  float ViewportMaxZ,
  [in]  XMMATRIX Projection,
  [in]  XMMATRIX View,
  [in]  XMMATRIX World

NOTE: Here you get some info about converting D3DXMath into DirectxMath.

share|improve this answer

The structures are passive data, the only difference is that the D3D11 flavor deals with floats instead of integers for most of the fields.

If your quantities are integral, simply construct a corresponding D3D10_VIEWPORT and call the function.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.