vertex rhw and camera in 2D

Started by
0 comments, last by Endurion 11 years, 4 months ago
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!
Advertisement
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>

This topic is closed to new replies.

Advertisement