ID3DXFont problem
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.
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.
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 coder919I don't think you actually need more than one sprite class, but I'm not entirely sure. I always have one ID3DXSprite instance.
Am I correct in using 2 different sprites, one for the rendering of everything else on the screen, and one for the fonts ???
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.
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.
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?
Try disabling the alpha blending?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement