Basic DirectX engine, in need of guidance

Started by
8 comments, last by c_back 19 years, 3 months ago
I'm attempting to incorporate the triple buffer (thanks :) xmesh tutorial into the base of an engine I'm writing. However, all I get is a black screen(from the g_pDevice->Clear call). I know it gets into the RenderTiny() function because when I change the Clear call's color, the window color changes. I just can't figure out why it wont display the mesh or what I'm missing. Any help would be appreciated. [Edited by - c_back on December 30, 2004 9:01:54 AM]
Advertisement
It may just be me, but I don't see that you set the projection matrix...

Hope that helps.
Thanks for the reply, Axiverse :)

Would it be this part that you meant:

int SetPerspective(){	D3DXMatrixPerspectiveFovLH( &m_matProjection, D3DX_PI/4.0f,     float(d3dpp.BackBufferWidth/d3dpp.BackBufferHeight), 1.0f, 1000.0f );    if( FAILED( g_pDevice->SetTransform(D3DTS_PROJECTION, &m_matProjection ) ) )	{         MessageBox(g_hWndMain, "SetTransform() Failed", "Error", MB_OK | MB_ICONINFORMATION );	     return E_FAIL;	}	OutputDebugString("Perspective set\n");    return true;}


Or would I have to do something more?
Oh, sorry. Well, have you tried to just render a triangle?

[edit]

Also I think this is wrong:

g_pDevice->SetRenderState( D3DRS_LIGHTING, 1 );

cause it is converted to the DWORD 0x00000001

where if you do:

*(DWORD*)(&1), it is represented as 0x01000000

i'm a little rusty on my booleans but isn't 1 false?

[edit]

ahem... nevermind about the boolean thing

[edit again]

anyways, if you make the background white and with or without light you will at least get a black silluette
thanks :)

trying that stuff
Sorry if I'm no help... Your problem most likely likes in the Mesh which I have no experience in whatsoever... =)
np. Turns out it wont render a triangle either. Not sure where my problem lies /sigh I know it loads the mesh/texture fine, though.

I think I'm missing part of the view/camera setup. Anyone?
Still working on this. If anyone has any guesses, they would be welcome.
You camera view seems to be way far into the Z axis. Depending on the proportion of your model, it may well be rendering but ur camera may not be within ur camera's view matrix. Try replacing the entire RenderTiny call with a RenderTriangle call.

In the render triangle call copy the render Triangle code from the Direct X tutorials. Note that the tutorial doesn't set any view, proj or world matrix. So make sure u aren't setting up any of the matrices previously in ur code either. If this works then it is almost certainly a problem with ur WVP matrices.

If it works, try setting the world matrice to identity and run it again. If it works (as it should), set up the projection matrice and run again. It should also work correctly, in which case ur view matrix is the odd one out and needs to be setup properly. Please note that the tiny.x is actually a very small model (at least it was in directX 8) and ur parameters may need to be scaled down quiet a bit too.

Anyway, I'm guessing here, but hope some of it has helped!
"There is no dark side of the moon." - Pink Floyd
Got it working, thank you all. Thanks Specchum :)

This topic is closed to new replies.

Advertisement