Hi,
I try to display text as HUD with my 3D engine.
The problem is that the screen is flickering and the 3D performances are low.
Can you help me ? ( I am also using Win32 for the window )
This is some code :
while (D3D11Rendering::exitThread == false)
{
D3D11Rendering::getInstance()->GBuffer();
D3D11Rendering::getInstance()->downsamplingPass();
D3D11Rendering::getInstance()->glowEffect.extractingColorPass();
D3D11Rendering::getInstance()->glowEffect.horizontalBlur();
D3D11Rendering::getInstance()->glowEffect.verticalBlur();
D3D11Rendering::getInstance()->LightingPass();
D3D11Rendering::getInstance()->glowEffect.blendGlowAndScene();
D3D11Rendering::getInstance()->text2D.renders2D();
D3D11Rendering::getInstance()->updateRendering();
}
void Text2D::renders2D()
{
renderTarget2D->BeginDraw();
renderTarget2D->Clear(D2D1::ColorF(D2D1::ColorF::Black));
drawText();
renderTarget2D->EndDraw();
}
void Text2D::drawText()
{
D2D1_RECT_F layoutRect = D2D1::RectF(D3D11Rendering::width-150.0f, D3D11Rendering::height-200.0f, D3D11Rendering::width, D3D11Rendering::height);
renderTarget2D->DrawText(
textToDisplay, // The string to render.
textLength, // The string's length.
textFormat.Get(), // The text format.
layoutRect, // The region of the window where the text will be rendered.
blackBrush.Get() // The brush used to draw the text.
);
}