Jump to content
  • Advertisement
Sign in to follow this  

ID3DXFont problem

This topic is 4430 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 in the process of writting a ID3DXFont wrapper, and everything seems great...almost. I have 2 sprites going on. 1 for my main rendering, and the other for the my font class. Everything renders fine, except the text is always behind the rest of my images. How can I get it to render in front??? Thank you in advance for your response.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Try turning of ztest when drawing the text.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Try turning off ztest when drawing the text.

Share this post


Link to post
Share on other sites
That's what I was trying, but honestly, I am not sure if I am doing it correctly,
check this out.

temp->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
temp->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);

Is that corect ??

Am I correct in using 2 different sprites, one for the rendering of everything else on the screen, and one for the fonts ???

Thank you again.

Share this post


Link to post
Share on other sites
Quote:
Original post by coder919
Am I correct in using 2 different sprites, one for the rendering of everything else on the screen, and one for the fonts ???
I don't think you actually need more than one sprite class, but I'm not entirely sure. I always have one ID3DXSprite instance.

You want to turn off the Z-test, not the writing or anything:
temp->SetRenderState(D3DRS_ZTEST, D3DCMP_ALWAYS);
(I think that's right, the render state name may be wrong). Disabling the Z-buffer entirely, like you do on your first line should have the same effect.

Share this post


Link to post
Share on other sites
Still have the same problem. I really don't get it.

I let D3D make it's own sprite ( by passing NULL as the first argument to drawtex)
and still having the same problem.

this is what I am doing:


render->PreRender();
render->ClearBuffer();

// this is the background
render->Render(back);
// rendering the rest of my objects
for(unsigned int i = 0; i < objectManager.objects.size(); i++)
render->Render(objectManager.objects);


// now rendering a chode string using a sprite
txt.DrawString("alkfdjlaksfjlkajflk;adsjjlksafkjsalkfjsie",&rc);
// now using drawtext without using a sprite
render->DrawText("Why is this is difficult?".rc);

Both texts print out, but they always behind everything on the screen.
The zBuffer is off.

During all this rendering I have my states as follows:
m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

Thank you for your quick replies, this is not letting me sleep in peace.






Share this post


Link to post
Share on other sites
Any screen short to have a look? I don't understand well what you mean by behind everything but still get drawn.

Try disabling the alpha blending?

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!