Well, I've been toying around with this, but I am still having the same issues. I'm sure I'm doing this completely wrong, but I thought I was on the right track.
I create the projection matrix at initialization, using dbGetProjectionMatrix(0) (i assume the int is the camera), then I set the transform to the projection matrix-also at initialization.
And as for the guts of the triangle function:
I create an empty world matrix and leave it alone. Since my triangle creation command is draw globally in the world matrix, I figured that should be left alone. I could be wrong. After that I set the transform to the world matrix--every frame.
Then, I create the view matrix using dbGetViewMatrix(0) (also assuming the int is camera). Afterwords, I set the transform to the view matrix--also every frame.
I guess I was kinda hoping that was the way it worked, but I was obviously wrong. Here is a listing of my header for further examination:
struct CUSTOMVERTEX
{
float x,y,z;
};
void Init()
{
dbGetDirect3DDevice()->SetTransform(D3DTS_PROJECTION, &dbGetProjectionMatrix(0));
};
void DrawTriangle(float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3)
{
D3DXMATRIX WorldMatrix;
D3DXMatrixTranslation(&WorldMatrix,0.0,0.0,0.0);
dbGetDirect3DDevice()->SetTransform(D3DTS_WORLD, &WorldMatrix);
dbGetDirect3DDevice()->SetTransform(D3DTS_VIEW, &dbGetViewMatrix(0));
CUSTOMVERTEX Vertices[] =
{
{x1, y1, z1},
{x2, y2, z2},
{x3, y3, z3}
};
dbGetDirect3DDevice()->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
};
I hate to ask, but if someone has some free time, could you possibly show a small example of using direct3d to draw a triangle to a gdk camera? My goal is to be able to display triangles without objects as quickly as possible.
Edit: cleaned up code a bit.