简体   繁体   中英

DirectX 11 -- Hello Triangle Not Rendering -- Cause: Multithread C++ Run-Time Library

The Tutorial works when Linked to Single-Threaded Run-Time Library :

http://www.rastertek.com/dx11s2tut04.html

Visual Studio 2017 -- Single-Threaded Run-Time Library is not an option.

Property Manager -> Common Properties -> C/C++ -> Code Generation -> Runtime

Multi-Threaded (/MT)
Multi-Threaded Debug (/MTd)
Multi-Threaded DLL (/MD)
Multi-Threaded DLL Debug (/MDd)

Solution 1) How to link with Single-Threaded Run-Time Library with Visual Studio 2017 or 2019.

Solution 2) A Hello Triangle tutorial that has Deferred Context, not Immediate Context.

class CameraClass
{
public:
    CameraClass();
    CameraClass(const CameraClass&);
    ~CameraClass();

    void SetPosition(float, float, float);
    void SetRotation(float, float, float);

    XMFLOAT3 GetPosition();
    XMFLOAT3 GetRotation();

    void Render();
    void GetViewMatrix(XMMATRIX&);

private:
//  I Used
    XMVECTOR position;
    XMVECTOR rotation;
//  instead of 
//  float m_positionX, m_positionY, m_positionZ;
//  float m_rotationX, m_rotationY, m_rotationZ;

    XMMATRIX m_viewMatrix;
};

Thus, Non-Virtual Methods have a function pointer cost per instance; or at least on the first instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM