Visual Studio调试显示了良好的结果,但exe并没有做我需要的

时间:2017-01-23 11:50:22

标签: c++ visual-studio-2015 directx-11

我正在学习DX11,现在有一个奇怪的问题。我正在生成位图font(bmfont utilite),程序应该渲染它。

启动Visual Studio调试时,一切正常:

enter image description here

但是在启动exe文件时,没有任何内容呈现,但调试日志表示所有内容都已正确初始化:

enter image description here

日志:

13:42:47::19: *DEBUG: Creating window
13:42:47::28: *DEBUG: initializing d3d
13:42:47::28: *DEBUG: client size 800 x 600
13:42:47::38: *DEBUG: driver type - 1 /1-hardware,2-reference,5-warp/
13:42:47::40: *DEBUG: render target view created
13:42:47::122: *DEBUG: font_0.tga texture loaded
13:42:47::123: *DEBUG: font_0.tga  - empty texture2d created
13:42:47::125: *DEBUG: font_0.tga  - texture2d data added
13:42:47::125: *DEBUG: font_0.tga  - shader resource view created
13:42:47::133: *DEBUG: font font.fnt shader created
13:42:47::135: *DEBUG: font font.fnt inited
13:42:47::136: *DEBUG: text created
13:42:47::137: *DEBUG: MyRender inited
13:47:17::269568: *DEBUG: font font_0.tga released
13:47:17::269570: *DEBUG: text released
13:47:17::269571: *DEBUG: releasing swap chain
13:47:17::269571: *DEBUG: releasing context
13:47:17::269574: *DEBUG: releasing device
13:47:17::269578: *DEBUG: Window Close

所有文件都在正确的目录中,我正在运行Visual Studio 2015.

bool MyRender::Init()
{
    m_font = new BitmapFont(this);
    if (!m_font)
    {
        Log::Get()->Err("font not created");
        return false;
    }
    m_font->Init("font.fnt");

    m_text = new Text(this, m_font);
    if (!m_text)
    {
        Log::Get()->Err("text not created");
        return false;
    }
    m_text->Init(L"testing texting", true, 20);

    Log::Get()->Debug("MyRender inited");
    return true;
}

bool MyRender::Draw()
{
    TurnZBufferOff();
    TurnAlphaBlendingOn();

    m_text->Draw(1.0f, 1.0f, 1.0f, 50.0f, 2.0f);

    return true;
}

m_text->画画(1.0f,1.0f,1.0f,50.0f,2.0f):R,G,B颜色,X,Y位置

0 个答案:

没有答案