How to set txture to top left of screen

Viewed 11

I'm trying to render a 960x540 texture in 1920x1080 screen, and want to set the picture at top left corner.So I changed the vertex buffer ,but It doesn't seem to work.Is there any method could achive this?Thanks in advance!

Vertex s_vertexData[4] =
    {
        { { -1.0f,  -1.0f, -0.5f, 1.0f }, { 0.f, 1.f } },
        { {  0.0f,  -1.0f, -0.5f, 1.0f }, { 1.f, 1.f } },
        { { 0.0f,  0.0f,  0.5f, 1.0f }, { 1.f, 0.f } },
        { { -1.0f,  0.0f,  0.5f, 1.0f }, { 0.f, 0.f } },
    };
    initialData.pSysMem = s_vertexData;
    bufferDesc.ByteWidth = sizeof(s_vertexData);
    bufferDesc.Usage = D3D11_USAGE_IMMUTABLE;
    bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    bufferDesc.StructureByteStride = sizeof(Vertex);

    DX::ThrowIfFailed(
        device->CreateBuffer(&bufferDesc, &initialData,
            m_spVertexBuffer.ReleaseAndGetAddressOf()));

0 Answers
Related