Hey guys, I'm not sure if I'm allowed to divert the subject a little bit as I'm trying to move from POSITIONT to POSITION. Obviously I'm trying to setup a 2D view... but now when I use D3DXMatrixOrthoOffCenterRH, my screen is completely black. Any thoughts? I'm coming from OpenGL and I think that's RH.
ZeroMemory(&d3dpp, sizeof(d3dpp)); // clear out the struct for use d3dpp.Windowed = TRUE; // program windowed, not fullscreen
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; // discard old frames
d3dpp.hDeviceWindow = hWnd; // set the window to be used by Direct3D
// create a device class using this information and information from the d3dpp stuct
d3d->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&this->d3d_device);
HRESULT hr;
D3DXMATRIX ortho2D;
D3DXMATRIX identity;
D3DXMatrixOrthoOffCenterRH(&ortho2D, 0.0f, UI::WindowSize::Instance().GetWindowWidth(), UI::WindowSize::Instance().GetWindowHeight(), 0.0f, -1.0f, 4.0f);
D3DXMatrixIdentity(&identity);
this->d3d_device->SetTransform(D3DTS_PROJECTION, &ortho2D);
this->d3d_device->SetTransform(D3DTS_WORLD, &identity);
this->d3d_device->SetTransform(D3DTS_VIEW, &identity);
This is my declaration:
D3DVERTEXELEMENT9 posColour_vec[] =
{
{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{ 1, 0, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 },
D3DDECL_END()
};
I'm setting my z to be 1.0f.
This is my Clear
this->d3d_device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0);