I started teaching myself DirectX a short time ago and have come across a problem which I can't figure out by myself unfortunately. I'm trying to build my own font system, so I can draw strings in 2D screenspace. Until now Until now I have managed to create a function to which I just have to pass the string and the screenspace-positions., and it generates all vertices for / sets up the buffers etc (quads that i draw a certain portion of the font texture on). When I draw these vertices in 3D space, everything looks like it works like it should be.
(Forgot to hide the cube) As soon as I try to switch to 2D, I just get a window filled with the blue backgroundcolor. To switch to 2D I do the following things:
graphics.context->ClearDepthStencilView(graphics.depthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0); context->OMSetDepthStencilState(depthDisabledStencilState, 1); WVP = XMMatrixOrthographicLH((float)mWidth, (float)mHeight, 0.0f, 1.0f); cbPerVert.WVP = XMMatrixTranspose(WVP); cbPerVert.World = XMMatrixTranspose(World); context->UpdateSubresource( cbPerVertexBuffer, 0, NULL, &cbPerVert, 0, 0 ); context->VSSetConstantBuffers( 0, 1, &cbPerVertexBuffer );
My Question is now what I am doing wrong here. If the vertices are being genrated and drawn correctly, afaik all I have to do is project them into screenspace and disable the depth buffer, which I did here.. BTW: I randomly tried drawing the cube with my 2D settings and it was properly drawn.. Help is much appreciated :)