Advertisement Jump to content
Sign in to follow this  

vertex rhw and camera in 2D

This topic is 2230 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,everybody, i am Alan Wu.
i got some questions here.Thanks for you guys's helping(before)!
i want to draw 2D object.
if i don't use rhw in the vertex,i can use SetTransform(D3DTS_VIEW) for setting the position of camera or somethings special.And i can use SetTransform(D3DTS_TEXTURE0) for setting the texture's matrix.
But if i use rhw,i can't do that,i call SetTransform(D3DTS_VIEW) but it doesn't change.I don't want lock vertex,can i change camera?
Well,yesterday i don't use rhw to simulate rhw,it works but do we have other method?
The code of below:
int width=792;//the width of view area
int height=566;//the height of view area
D3DXMATRIX V;//the matrix of view
D3DXMatrixTranslation(&V,-(width/2),height/2,-1);//if i don't use rhw,the point(0,0) is in the middle of view area,and x-axis is up, y-axis is right
Device->SetTransform(D3DTS_VIEW, &V);
//lock vertex,change y to negative
i don't know does this method good or not,if you have better method, please tell me.
Thanks everybody!

Share this post

Link to post
Share on other sites
RHW means pretransformed, so no matrix operations are applied.

For the vertices this means, either Lock/Modify/Unlock or use DrawPrimitiveUP. Depending on the amount of change the objects both may be fine. The first (vertex buffers) are better for static objects, the latter for dynamic.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!