Sign in to follow this  

coordinates

This topic is 3628 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

Dear people What kind of coordinates are these (comming from matrices): CUSTOMVERTEX g_Vertices[] = { { -1.0f,-1.0f, 0.0f, 0xffff0000, }, { 1.0f,-1.0f, 0.0f, 0xff0000ff, }, { 0.0f, 1.0f, 0.0f, 0xffffffff, }, }; and how does Direct3D knows them from (screen coordinates)?: CUSTOMVERTEX vertices[] = { { 150.0f, 50.0f, 0.5f, 1.0f, 0xffff0000, }, // x, y, z, rhw, color { 250.0f, 250.0f, 0.5f, 1.0f, 0xff00ff00, }, { 50.0f, 250.0f, 0.5f, 1.0f, 0xff00ffff, }, }; Thank you in advance

Share this post


Link to post
Share on other sites
The first type are untransformed vertices. i.e. you have supplied vertices that have not yet been transformed so D3D will apply the world view and projection matrices to transform them into screen space.

The second type are transformed vertices. i.e. you have supplied vertices that have already been transformed into screen space (as far as D3D is concerned - you may have just defined them in screen space).


How does D3D know which vertices it needs to transform? The FVF (Flexible Vertex Format) code that you specify when you use the vertices will have either the D3DFVF_XYZ (untransformed) flag or the D3DFVF_XYZRHW (transformed).


Note: the above assumes you are using the legacy (DX7 style) fixed function pipeline (the mention of RHW in the comment in your code leads me to think you are). With shaders you would be using vertex declarations instead of FVF codes and the operations that happened to untransformed vertices would be whatever your vertex shader wanted to do to them.

Share this post


Link to post
Share on other sites

This topic is 3628 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this