Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Eibwen

Problem with Ortho2D mode

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

Hi i try to render some simple polygons in 2D: D3DXMatrixOrthoLH(&Ortho2D, WIDTH, HEIGHT, 0.0f, 1.0f); D3DXMatrixIdentity(&Identity); SetTransform(D3DTS_PROJECTION, &Ortho2D); SetTransform(D3DTS_WORLD, &Identity); SetTransform(D3DTS_VIEW, &Identity); SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE); SetRenderState(D3DRS_LIGHTING, FALSE); i render a simple triangle in the middle of the screen dev->Clear( 0, NULL, D3DCLEAR_TARGET, 0x0000FF00, 1.0f, 0 ); dev->BeginScene(); dev->SetTexture( 0, NULL ); InVertex test[3]; test[0].x= 0.0f; test[0].y=-10.0f; test[0].z= 1.0f; test[0].c=0xFFFFFFFF; test[1].x= 10.0f; test[1].y= 10.0f; test[1].z= 1.0f; test[1].c=0xFFFFFFFF; test[2].x=-10.0f; test[2].y= 10.0f; test[2].z= 1.0f; test[2].c=0xFFFFFFFF; dev->SetVertexShader(T_INVERTEX); dev->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, test, sizeof(InVertex)); dev->EndScene(); This doesnt show anything just a green background. But when i change the T_INVERTEX description to include rhw=1.0f it works fine and draws a white triangle at the right screen coordinates. i guess i missed something stupid Eibwen [edited by - Eibwen on December 26, 2002 12:11:21 PM]

Share this post


Link to post
Share on other sites
Advertisement
What I gathered based on your code...

You are specifing your vertices co-ordinates in a Counter Clock Wise (CCW) direction.

Try either to rearrange them ClockWise (CW) or change the culling render state to D3DCULL_CW or D3DCULL_NONE...

Having said that, I don't think that with the 'rhw' vertex format you saw anything as well - 'cause the order of the vertices was still backwards.

Maybe with transformed vertices culling isn't enforced....?

[edited by - NE1 on December 26, 2002 4:44:31 PM]

Share this post


Link to post
Share on other sites

  • 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!