Skip to main content
GameDev.net gamedev.net
🔒 Locked

3D TO 2D Problem

Started by Drazgal Feb 18, 2003 at 2:50 AM 2 replies 300+ views
Original Post
Drazgal
Drazgal
I''ve bee tryig to set up some code to draw (for example) a 128*128 bitmap to screen in Direct3D (while keeping the size the same on screen). Im getting along just fine with trasformed vertices (using rhw). However I want to be able to do it with untransformed vertices. I think my problems might come from a misunderstading of the graphics pipeline. I thought that vertices were first multiplied by the WORLD transform matrix then by the VIEW matrix then the PROJECTION matrix. So I thought if I set all three to idetity matrices then nothing should happen to my vertices (set make a quad from 0,0,0 to 128,128,0). I tried this then the bitmap just disapered. I also tried setting the WORLD and VIEW to identities ad set the projection matrix as I normally would, but change the viewport to 0,0 128,128. This also failed to work. I was wondering if anyone could tell me or point me to the right direction of how to display the bitmap using a primative and keeping the right size of the bitmap on screen?
IFooBar
IFooBar
set up an orthographic projection. and the size will be whatever you set it. Use this function to set your projection matrix

D3DXMatrixOrthoLH

view and world should be dealt with as normal.


:::: [ Triple Buffer V2.0 ] ::::
[size=2]aliak.net
Muhammad Haggag
Muhammad Haggag
Following the projection transformation, there''s a viewport transformation. The viewport transformations maps coordinates from [-1,+1] to the viewport (input coordinates for the vport transformation are expected to be in the range [-1,+1])

You''d better use orthogonal projection for that: Use D3DXMatrixOrthoLH or something similar to create a projection matrix.

www.andypike.com has got a tutorial about doing this.

Cheers,
Muhammad Haggag

Drazgal
Drazgal
Thanks alot!!!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.