Jump to content
  • Advertisement
Sign in to follow this  
BloodLust666

ortho camera far images not showing

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

I have an ortho camera set up with planes 1.0f to 5.0f. I have my foreground textures at 1.0f and my background textures at 5.0f. But for some reason the backgrounds won't work, even when i put them at 2.0f. This is a 2D game by the way. Also, when i call the sprite begin, i'm calling draw FrontToBack so it sorts out but it still doesn't show the background...

Share this post


Link to post
Share on other sites
Advertisement
void cGraphics3d::Set2DOrtho()
{
D3DXMATRIX matrix;
D3DXMatrixOrthoRH( &matrix, (float)m_Width, (float)m_Height, 1.0f, 5.0f );
m_pD3dDevice->SetTransform( D3DTS_PROJECTION, &matrix );
}

// .. Code
Graphics3d.Set2DOrtho();

GetTexture(1)->SetX(512);
GetTexture(1)->SetY(150);
GetTexture(1)->SetZ(1);
GetTexture(6)->SetX(512);
GetTexture(6)->SetY(0);
GetTexture(6)->SetZ(2);

// The SetX,Y,Z just have D3DXVECTOR3 Pos variable and it manipulates those values.

Share this post


Link to post
Share on other sites
Quote:
Original post by EvilKnuckles666
D3DXMatrixOrthoRH( &matrix, (float)m_Width, (float)m_Height, 1.0f,


I think you might want to use D3DXMatrixOrthoLH. With a Right hand coordinate system the Z axis points the other way (negative is deeper into the screen).

Share this post


Link to post
Share on other sites
If your game is pure 2D then you can allow ID3DXSprite to handle the scene transformations for you.

So far I haven't encountered any problems with sprites not showing when I let ID3DXSprite handle transformations. But then I don't usually play around so much with the z-coord when calling Draw( ). I usually use z = 0.0f and draw the sprites back to front manually.

Share this post


Link to post
Share on other sites
well i would do that, but they way i made my engine, i add the textures i need, then it draws them in the order i added them. i need to be able to set a different Z coordinate for the different priority level each texture has.

Share this post


Link to post
Share on other sites
You could actually just sort your items befor rendering them ... so you first render the background and afterwards everything else ... but I think that 1.0f is the most far point which is rendered ... did you try setting the background to 1.0f and the other stuff to dunno 0.9f as example... maybe this could work ... when using OrthoLH Matrix all objects should appear same size in spite of their distance to the camera...

cheers,
Marcel

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!