Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm writing an application which renders graphics on the screen. The application can switch between Direct3D9 and Direct3D10 graphics modules (I wrote DLLs that wrap both D3D9 and D3D10). When trying to render a test mesh (a torus which comes as a stock mesh in D3DX9 and in DXUT library you can find in DirectX10 samples), Direct3D10 module behaves rather weird. Here's what I get.

D3D9: Torus rendered by D3D9 module.

D3D10: Torus rendered by D3D10 module

The view, projection and world matrices are the same for both cases. The only thing that differs is the device initialization code, and the HLSL effect files (for simplicity I only apply ambient colors and don't use advanced lighting, texturing etc). Can this be because of wrong device initialization or because of bad shaders? I would appreciate any hint. I can post any code pieces by request.

Thanks in advance.

share|improve this question
1  
Could be the wrong matrix order, eg passing row major when the shader expects column major or vice vesa. Try if swapping the order of the operants in your mul() calls fixes this. –  Archy Feb 27 '13 at 12:25
    
OK, I'll try that. Though I'm sure the multiplication order is unchanged across D3D9 and D3D10 versions. –  george.zakaryan Feb 27 '13 at 12:27
3  
It definitely looks like a transposed projection matrix. You could debug this using PIX. –  Archy Feb 27 '13 at 13:00
1  
Without sharing the relevant code it's going to be hard to help you beyond that (assuming you haven't figured it out already). –  Tetrad Feb 27 '13 at 22:20
1  
Can you post the vertex/pixel shaders and input layouts? Some of the input element semantics have changed between D3D9 and 10/11 I believe –  melak47 Feb 28 '13 at 2:27
show 3 more comments

closed as too localized by Sean Middleditch, bummzack, Byte56, Trevor Powell, Ali.S Mar 15 '13 at 23:27

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

Thanks to everyone for trying to help. I figured it out. The reason for that was because somehow the position variable in vertex shader had garbage in its w component. After assigning 1.0f to that the shader worked as expected.

share|improve this answer
add comment

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