Jump to content
  • Advertisement
Sign in to follow this  
Fire Lancer

Getting started with D3D10, vertices question

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

My understanding was that a vertex shader is meant to output vertices in screen cordinates. Ie such that (0,0,0) is the top left and (bufferWidth,bufferHeight,0) is the bottom right. So how does this result in a triangle in the centre of the screen???
//vertices
    SimpleVertex vertices[] =
    {
        D3DXVECTOR3( 0.0f, 0.5f, 0.5f ),
        D3DXVECTOR3( 0.5f, -0.5f, 0.5f ),
        D3DXVECTOR3( -0.5f, -0.5f, 0.5f ),
    };
//vertex shader
float4 VS( float4 Pos : POSITION ) : SV_POSITION
{
    return Pos;
}

To that end, what do I need to do to make it work the same as the following transforms with the fixed function pipeline under D3D9? (size is the size of the client area of the window, which is the same as the size of the backbuffer). This makes the z axis be ignored and (0,0) top left and (size.w,size.h) bottom right.
	D3DXMATRIXA16 mat;
	//view
	D3DXMatrixIdentity(&mat);
	device->SetTransform(D3DTS_VIEW, &mat);
	//projection
	D3DXMatrixOrthoOffCenterLH(&mat,
		0,(float)(size.w),
		(float)(size.h), 0,
		0, 1);
	device->SetTransform(D3DTS_PROJECTION, &mat);

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!