Question

In my DrawIndexedPrimite function i have:

myDevice->GetTransform( D3DTS_VIEW, &view_matrix );
myDevice->GetTransform( D3DTS_PROJECTION, &proj_matrix );
myDevice->GetTransform( D3DTS_WORLD, &world_matrix );
myDevice->GetViewport( &d3dvp );

This works fine on Windows 7:

View Matrix:
     view_matrix._11 : -1
     view_matrix._12 : -8.74095e-008
     view_matrix._13 : -0
     view_matrix._14 : 0
     view_matrix._21 : 8.73962e-008
     view_matrix._22 : -0.999848
     view_matrix._23 : -0.0174524
     view_matrix._24 : 0
     view_matrix._31 : -1.5255e-009
     view_matrix._32 : 0.0174524
     view_matrix._33 : -0.999848
     view_matrix._34 : 0
     view_matrix._41 : -32.4
     view_matrix._42 : 23.3582
     view_matrix._43 : 39.061
     view_matrix._44 : 1
Projection Matrix:
     proj_matrix._11 : 1.19175
     proj_matrix._12 : 0
     proj_matrix._13 : 0
     proj_matrix._14 : 0
     proj_matrix._21 : 0
     proj_matrix._22 : 1.60573
     proj_matrix._23 : 0
     proj_matrix._24 : 0
     proj_matrix._31 : -0
     proj_matrix._32 : -0
     proj_matrix._33 : 1.00025
     proj_matrix._34 : 1
     proj_matrix._41 : 0
     proj_matrix._42 : 0
     proj_matrix._43 : -0.125031
     proj_matrix._44 : 0
World Matrix:
     world_matrix._11 : 0.0245525
     world_matrix._12 : -0.00470921
     world_matrix._13 : 0
     world_matrix._14 : 0
     world_matrix._21 : -0.00470921
     world_matrix._22 : -0.0245525
     world_matrix._23 : 3.7749e-009
     world_matrix._24 : 0
     world_matrix._31 : -7.11072e-010
     world_matrix._32 : -3.70732e-009
     world_matrix._33 : -0.025
     world_matrix._34 : 0
     world_matrix._41 : -54.0003
     world_matrix._42 : 5.19991
     world_matrix._43 : 8.63542
     world_matrix._44 : 1
Viewport:
     d3dvp.X      : 0
     d3dvp.Y      : 0
     d3dvp.Width  : 1024
     d3dvp.Height : 760
     d3dvp.MinZ   : 0
     d3dvp.MaxZ   : 1

BUT on WINDOWS XP i get:

View Matrix:
     view_matrix._11 : 1.88473e-017
     view_matrix._12 : 1.68653
     view_matrix._13 : 1.35358e-017
     view_matrix._14 : 1
     view_matrix._21 : 5.6036e-038
     view_matrix._22 : 0
     view_matrix._23 : 0
     view_matrix._24 : 0
     view_matrix._31 : 0
     view_matrix._32 : 1.63149
     view_matrix._33 : 0
     view_matrix._34 : 0
     view_matrix._41 : -0
     view_matrix._42 : -0
     view_matrix._43 : 1.00025
     view_matrix._44 : 7.69183e+009
Projection Matrix:
     proj_matrix._11 : 2.37597e-039
     proj_matrix._12 : 2.08572e-039
     proj_matrix._13 : 2.37597e-039
     proj_matrix._14 : 2.37598e-039
     proj_matrix._21 : 0
     proj_matrix._22 : 1.73879e-039
     proj_matrix._23 : 1.7389e-039
     proj_matrix._24 : 8.22303e+009
     proj_matrix._31 : -1.#QNAN
     proj_matrix._32 : 1.73892e-039
     proj_matrix._33 : 7.69167e+009
     proj_matrix._34 : 2.37597e-039
     proj_matrix._41 : 0
     proj_matrix._42 : 3.27402e-039
     proj_matrix._43 : 7.69167e+009
     proj_matrix._44 : 2.37598e-039
World Matrix:
     world_matrix._11 : 3.4712e-035
     world_matrix._12 : 2.38806e-039
     world_matrix._13 : 7.95398e-037
     world_matrix._14 : 2.37598e-039
     world_matrix._21 : 0
     world_matrix._22 : 1.73887e-039
     world_matrix._23 : 1.7394e-039
     world_matrix._24 : 8.22302e+009
     world_matrix._31 : 1.4013e-045
     world_matrix._32 : 3.72838e-035
     world_matrix._33 : 7.85314e-037
     world_matrix._34 : 2.37597e-039
     world_matrix._41 : 0
     world_matrix._42 : 3.27402e-039
     world_matrix._43 : 0
     world_matrix._44 : 4.48416e-044
Viewport:
     d3dvp.X      : 0
     d3dvp.Y      : 0
     d3dvp.Width  : 1024
     d3dvp.Height : 748
     d3dvp.MinZ   : 0
     d3dvp.MaxZ   : 1

Onliest "correct" thing here seems to be the Viewport.

Any suggestions how to "fix" that?

Thanks in advance.

Was it helpful?

Solution

The common situation where GetTransform fails but GetViewport succeeds is where the device has been created with D3DCREATE_PUREDEVICE.

For GetTransform, MSDN says:

This method will not return device state for a device that is created using D3DCREATE_PUREDEVICE. If you want to use this method, you must create your device with any of the other flag values in D3DCREATE.

However, for GetViewport, MSDN says:

Typically, methods that return state will not work on a device that is created using D3DCREATE_PUREDEVICE. This method however, will work even on a pure device.

I suspect that the device creation is being handled differently on the two operating systems. As you've tagged your question with hook, I'm guessing you may not have access to the source code, but if you do - perhaps you can post the device creation portion.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top