ID3DXFont problem

Started by
9 comments, last by coder919 18 years ago
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.
Advertisement
Are you rendering the text last? If not, that should fix the problem.

-Chris
Yes sir, and still having the same problem.

Thank you for your reply
Try turning of ztest when drawing the text.
Try turning off ztest when drawing the text.
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.
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.
I only use 1 sprite



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.






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?
The poorest programmer in the game industry!!

This topic is closed to new replies.

Advertisement