# Help with pixels and vertices.

This topic is 4091 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
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 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 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;

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634059
• Total Posts
3015294
×