Jump to content
  • Advertisement
Sign in to follow this  
becoolnike

Help with pixels and vertices.

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

How to draw a quad of 100 pixels by 100 pixels in a back buffer of 640 by 480 and a using a format of D3DFMT_R5G6B5,D3DFVF_XYZ; (X : -1; Y : -1; Z : 0 ), (X : -1; Y : 1; Z : 0), (X : 1; Y : -1; Z : 0), (X : 1; Y : 1; Z : 0) For excample I draw a quad using the above information but i dont have idea about its real pixels size because direct3d uses float numbers and not integers.

Share this post


Link to post
Share on other sites
Advertisement
Use the D3DFVF_XYZRHW FVF type to specify that the vertices are pre-transformed. This way you can just set your vertices using screen coordinates, like this:



(X : 0; Y : 0; Z : 0 ),
(X : 0; Y : 100; Z : 0 ),
(X : 100; Y : 0; Z : 0 ),
(X : 100; Y : 100; Z : 0 )

Share this post


Link to post
Share on other sites
thank you. I'll use it. One question how to the use the u and v texture cordinates to match the quad? i use the folowwiing but it doest not match the quad.


vertexarray[0].color := $FFFFFFFF;
vertexarray[0].x := 0;
vertexarray[0].y := 0;
vertexarray[0].z := 0.0;
vertexarray[0].rhw := 1.0;
vertexarray[0].u := 0.0;
vertexarray[0].v := 1.0;

vertexarray[1].color := $FFFFFFFF;
vertexarray[1].x := 0;
vertexarray[1].y := 100;
vertexarray[1].z := 0.0;
vertexarray[1].rhw := 1.0;
vertexarray[1].u := 0.0;
vertexarray[1].v := 0.0;

vertexarray[2].color := $FFFFFFFF;
vertexarray[2].x := 100;
vertexarray[2].y := 0;
vertexarray[2].z := 0.0;
vertexarray[2].rhw := 1.0;
vertexarray[2].u := 1.0;
vertexarray[2].v := 1.0;

vertexarray[3].color := $FFFFFFFF;
vertexarray[3].x := 100;
vertexarray[3].y := 100;
vertexarray[3].z := 0.0;
vertexarray[3].rhw := 1.0;
vertexarray[3].u := 1.0;
vertexarray[3].v := 0.0;

[Edited by - becoolnike on November 5, 2007 1:21:30 PM]

Share this post


Link to post
Share on other sites
Try this:

vertexarray[0].color := $FFFFFFFF;
vertexarray[0].x := 0;
vertexarray[0].y := 0;
vertexarray[0].z := 0.0;
vertexarray[0].rhw := 1.0;
vertexarray[0].u := 0.0;
vertexarray[0].v := 0.0;

vertexarray[1].color := $FFFFFFFF;
vertexarray[1].x := 100;
vertexarray[1].y := 0;
vertexarray[1].z := 0.0;
vertexarray[1].rhw := 1.0;
vertexarray[1].u := 1.0;
vertexarray[1].v := 0.0;

vertexarray[2].color := $FFFFFFFF;
vertexarray[2].x := 100;
vertexarray[2].y := 100;
vertexarray[2].z := 0.0;
vertexarray[2].rhw := 1.0;
vertexarray[2].u := 1.0;
vertexarray[2].v := 1.0;

vertexarray[3].color := $FFFFFFFF;
vertexarray[3].x := 0;
vertexarray[3].y := 100;
vertexarray[3].z := 0.0;
vertexarray[3].rhw := 1.0;
vertexarray[3].u := 0.0;
vertexarray[3].v := 1.0;

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!