Jump to content

  • Log In with Google      Sign In   
  • Create Account

vertex rhw and camera in 2D


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 AlanWu   Members   -  Reputation: 191

Like
0Likes
Like

Posted 09 December 2012 - 07:57 PM

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
vertices2[0].y=-(vertices2[0].y);
"
i don't know does this method good or not,if you have better method, please tell me.
Thanks everybody!

Sponsor:

#2 Endurion   Crossbones+   -  Reputation: 3558

Like
0Likes
Like

Posted 09 December 2012 - 11:19 PM

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.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS