• 13
• 18
• 19
• 27
• 10

# Basic DirectX engine, in need of guidance

This topic is 4827 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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]

##### Share on other sites
It may just be me, but I don't see that you set the projection matrix...

Hope that helps.

##### Share on other sites
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?

##### Share on other sites
Oh, sorry. Well, have you tried to just render a triangle?

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?

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

##### Share on other sites
thanks :)

trying that stuff

##### Share on other sites
Sorry if I'm no help... Your problem most likely likes in the Mesh which I have no experience in whatsoever... =)

##### Share on other sites
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?

##### Share on other sites
Still working on this. If anyone has any guesses, they would be welcome.

##### Share on other sites
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!