Sign in to follow this  

Basic DirectX engine, in need of guidance

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 this post


Link to post
Share on other sites
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

Share this post


Link to post
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 this post


Link to post
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!

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this