# Drawing a quad in normalized device coordinates

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

## Recommended Posts

can anyone explain what normalized device coordinates are?, is it the same idea as RHW for vertices when you set the FVF?

heres a picture of the radar rendering

http://i.imgur.com/Osq4Bml.png?1

// Viewport is entire texture.
D3DVIEWPORT9 vp = { 0, 0, 256, 256, 0.0f, 1.0f };
mRadarMap = new DrawableTex2D(256, 256, 0, D3DFMT_X8R8G8B8, true, D3DFMT_D24X8, vp, mAutoGenMips);
HR(gd3dDevice->CreateVertexBuffer(6*sizeof(VertexPT), D3DUSAGE_WRITEONLY,

// normalized device coordinates.  I.e., world, view, projection matrices are all
// identity.
VertexPT* v = 0;
v[0] = VertexPT(0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
v[1] = VertexPT(1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
v[2] = VertexPT(0.0f, -1.0f, 0.0f, 0.0f, 1.0f);
v[3] = VertexPT(0.0f, -1.0f, 0.0f, 0.0f, 1.0f);
v[4] = VertexPT(1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
v[5] = VertexPT(1.0f, -1.0f, 0.0f, 1.0f, 1.0f);

Edited by Anddos

##### Share on other sites

Normalized device coordinates are set up such that (-1, -1) is the bottom left of the screen, and (1, 1) is the top right. It's a little different than RHW, because with that you use pixel coordinates (top right of the screen is (ScreenWidth, ScreenHeight).

##### Share on other sites

Thanks i sort of understand it, but it is strange to me

##### Share on other sites

the rendering pipeline has 4 frames of reference, and three transform matrices that translate between them:

object space (object local coords) -> world transform matrix -> world space (world coords) - > view transform matrix -> camera space (normalized coords) -> projection transform matrix -> screen space (screen coords).

they're defining a quad that's in camera space, so then they can simply apply the projection matrix and it always displays in the same spot on the screen, irregardless of the world and view transforms.

d3dxsprites is probably a better way to do it.

1. 1
2. 2
Rutin
20
3. 3
khawk
17
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633757
• Total Posts
3013711
×