Original Post
Please keep in mind this is one of my first attempts at Direct3D....
Here is my init code for D3D (basically):
It works, but I''m just putting it in to provde more info.:
/*
* Get Direct3D object
*/
lpdd->QueryInterface(IID_IDirect3D7, (LPVOID *)&lpd3d);
/*
* Create a Direct3D device
*/
if (D3D_OK != lpd3d->CreateDevice(IID_IDirect3DHALDevice, lpBuffer, &lpDevice))
{
if (D3D_OK != lpd3d->CreateDevice(IID_IDirect3DMMXDevice, lpBuffer, &lpDevice))
{
lpd3d->CreateDevice(IID_IDirect3DRGBDevice, lpBuffer, &lpDevice);
DebugEvent("Using RGB device");
}
else
DebugEvent("Using MMX device");
}
else
DebugEvent("Using HAL device");
/*
* Set up a viewport
*/
ZeroMemory(&Viewdata, sizeof(Viewdata));
Viewdata.dwWidth = 800;
Viewdata.dwHeight = 600;
Viewdata.dvMinZ = D3DVALUE(-10.0);
Viewdata.dvMaxZ = D3DVALUE(25.0);
/*
* Create the viewport
*/
lpDevice->SetViewport(&Viewdata);
Anyway, that part works fine - I copied/converted it to DX7 from the "Tile Engine in D3D" article. I also tried using some of the code from this article to render a triangle.
However, when I try to introduce the "sz" property of the D3DTLVERTEX structures, I find that they have no visible effect on the screen.
I know some basic 3D things, and I think that this is because I need to set up a projection matrix (and I assume this isn''t done in the tile-rendering demos) ?
I think that to set up a projection matrix you use IDirect3DDevice7::SetTransform, but I am unsure.
Another question for me is how to set up a projection matrix?
Thanks for reading