• Advertisement
Sign in to follow this  

pls help me with few directx doubts... Am a beginner

This topic is 1855 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 am a beginner in game programming and i am learning direct x 10 from the book 'intro. To 3d game programming with direct x 10' . I have lots of doubts.Please help me 1. Most of the time i am confused with view matrix and projection matrix.
ie i am lost in 3d space. I placed a triangle pyramid at the centre with co-ordinates
-1 0 1 , 0 1 1 , 1 0 1,
-1 0 4 , 0 1 4 , 1 0 4

and used index buffer to specify indices .... And i am sure that it is correct... Now i am problem with view and projection matrix

D3DXMatrixPerspectiveForLH(&proj, 0.5f * D3DX_PI , aratio , 1, 1000);

D3DXMatrixLookAtLH(&View , &pos , &target , &up);

where pos = 0 4 -1 target = 0 1 1

now what i see is a screen shows is a single color which i set for second vortex. I didn't see any 3d object.... I am sure that the problem is with placing virtual camera . Please help me with this problem on how to place the camera and what should me its projection matrix .....

2. How to program a 3d navigable interface just like in first person games and one additional thing is that if i want to go up i should be able to go in that direction....
At lease i myself move around that 3d space and look around for that object that i have placed there.

3. To display text I used GDI textout fn but it is not displayed.. So how to use gdi with direct 3D
(I know Win32 api for a good extent)

Share this post


Link to post
Share on other sites
Advertisement
[quote name='rockvignesh25' timestamp='1355895587' post='5012342']
please bear me with spellings ... I am lazy in typing
[/quote]

Don't take my word from it, but i've heard that Directx 10 is kinda, well... not used much. Directx 9 or 11 are the most used ones. Why you choose Directx 10?

Share this post


Link to post
Share on other sites
[quote]
Don't take my word from it, but i've heard that Directx 10 is kinda, well... not used much. Directx 9 or 11 are the most used ones. Why you choose Directx 10?
[/quote]

I believe that DX9 is supported still simply because older cards still cling to it but aren't up to DX10, DX10 is for newer cards on XP, DX11 ships with Win7 only.

DX10's advantage over DX9 is more shader flexibility. And a little performance. But that's about it. I really cannot claim to know more on the subject difference between the two.

Share this post


Link to post
Share on other sites
[quote name='Morley' timestamp='1355936141' post='5012488']
I believe that DX9 is supported still simply because older cards still cling to it but aren't up to DX10, DX10 is for newer cards on XP, DX11 ships with Win7 only.
[/quote]
Morley, DirectX 10 doesn't work with XP. It was one of the big reasons PC gamers jumped on Vista: the first Windows OS to actually support DX10 code. Anything on XP has to resort to DX9.0c features.

DirectX 11 is able to down-level to DX10 feature levels, and runs on Vista, which is why 11 is more prevalent than 10: if you're targeting DX10, you can use DX11, because you've already excluded XP users.

Rockvignesh25: have you defined your viewport? That helps the rendering pipeline determine where matrix-transformed pixels actually appear relative to the display buffer's borders.

Share this post


Link to post
Share on other sites
[quote name='BCullis' timestamp='1355937284' post='5012500']
[quote name='Morley' timestamp='1355936141' post='5012488']
I believe that DX9 is supported still simply because older cards still cling to it but aren't up to DX10, DX10 is for newer cards on XP, DX11 ships with Win7 only.
[/quote]
Morley, DirectX 10 doesn't work with XP. It was one of the big reasons PC gamers jumped on Vista: the first Windows OS to actually support DX10 code. Anything on XP has to resort to DX9.0c features.

DirectX 11 is able to down-level to DX10 feature levels, and runs on Vista, which is why 11 is more prevalent than 10: if you're targeting DX10, you can use DX11, because you've already excluded XP users.

Rockvignesh25: have you defined your viewport? That helps the rendering pipeline determine where matrix-transformed pixels actually appear relative to the display buffer's borders.
[/quote]

vp.topleftx = 0
vp.toplefty = 0
vp.width = 1600 // my screen resolution
vp.height = 900
vp.mindepth = O.O
vp.maxdepth = 1.0

Share this post


Link to post
Share on other sites
pls anybody teach me abt placing this so called 'virtual camera' and also about its projection matrix in detail

i choose direct x 10 because i have bought the book for it .... I have also found that 11 and 10 are almost same (from program code point of view) and i thought it would be easy for me to get used with it.

Share this post


Link to post
Share on other sites
the "virtual camera" is just the easiest way to think about, and group, properties related to calculating your view and projection matrices.
At its core, the common "camera" class has a world-space position, relative to a world-space origin. This position is used to create the "lookat" matrix, or your view matrix, which has the effect of rotating and translating vertex data (defined in world space) so that it is rendered relative to where you've placed the virtual camera, giving the effect of viewing the scene from the camera's location.

The perspective projection matrix creates the depth effect of 3d by making further objects appear smaller and creating the parallax scrolling effect of distant objects moving across your view slower than near objects. It is also responsible for translating data in view-space to screen-space. It uses field-of-view (FOV) angle, aspect ratio of the screen (or render window), and near- and far-plane distance values to calculate a 3d frustum volume representing everything the camera can see in view-space.

The key to their interaction is [b]multiplication order[/b]. The standard path is to multiply scene objects (specifically their vertices) by their world matrix (not necessary in your case, you've explicitly placed the triangle, but something you could use to move said triangle around if you wanted), then by the view matrix (orients the scene to where your camera is looking) and finally by the perspective matrix (to convert to screen-space). My first guess is you've got the multiplication order backwards. (This is much easier to detect when you have controls in place to move the camera around.)

Share this post


Link to post
Share on other sites
[quote name='Morley' timestamp='1355936141' post='5012488']
[quote]
Don't take my word from it, but i've heard that Directx 10 is kinda, well... not used much. Directx 9 or 11 are the most used ones. Why you choose Directx 10?
[/quote]

I believe that DX9 is supported still simply because older cards still cling to it but aren't up to DX10, DX10 is for newer cards on XP, DX11 ships with Win7 only.

DX10's advantage over DX9 is more shader flexibility. And a little performance. But that's about it. I really cannot claim to know more on the subject difference between the two.
[/quote]
DX9 is still supported because the PS3 and X360 only support DX9+ level features(PS3 doesn't support D3D at all btw), it has nothing to do with older cards. DX 10 and 11 ship from Vista not what you said and since DX11 support feature levels there is no reason other then the consoles to support a DX9 path. We dropped PC DX9 support with DiRT: Showdown, but where thinking of doing this on DiRT 3 already.

[quote name='rockvignesh25' timestamp='1355980661' post='5012711']
pls anybody teach me abt placing this so called 'virtual camera' and also about its projection matrix in detail

i choose direct x 10 because i have bought the book for it .... I have also found that 11 and 10 are almost same (from program code point of view) and i thought it would be easy for me to get used with it.
[/quote]
Then start coding for 11, nowadays learning DX10 has no uses what so ever, jobs ask for DX11 or OpenGL 4 now. Also DX 11 fixed a few things that DX 10 got wrong. Edited by NightCreature83

Share this post


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

  • Advertisement