Jump to content
  • Advertisement
Sign in to follow this  
LevyDee

Possible to set a z location for sprites in clip space?

This topic is 2337 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 am using D3DXFont to do my engine UI text , and I would like to know if there is a way to adjust its z location in clip space(0.0 - 1.0). As far as I can tell, there is no way to do this, but someone out there might have some more insight on this. Any ideas?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
Perhaps you could do it by setting a transform onto the ID3DXSprite?

Share this post


Link to post
Share on other sites
[quote name='xyzzy00']
You can control the depth at which your UI text draws something like this:


pSprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE | D3DXSPRITE_SORT_DEPTH_BACKTOFRONT);

...

D3DXMATRIX xform;
D3DXMatrixTranslation(&xform, 0.0f, 0.0f, depth);
pSprite->SetTransform(&xform);
pFont->DrawText(pSprite, ...);

...

pSprite->End();



Setting the sprite transform will effect everything you draw subsequently with that sprite object. So when you draw the sprites for your other UI widgets, you'll probably want to specify 0 for the z-value of their position. And 'depth' should be a value between 0 and 1.

Also, make sure you are using the latest DXSDK. They just added the ability to specify both D3DXSPRITE_SORT_TEXTURE and D3DXSPRITE_SORT_DEPTH_BACKTOFRONT at the same time in the last update.

xyzzy[/quote]

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.

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!