Sign in to follow this  
ZeRaW

DX UT rendering

Recommended Posts

I am writing a small engine, for now i can load a mesh and wrote a texture manager and small stuff. I am trying to get it running with DXUT. I have no idea on ID3DXEffect and honestly I do not want to use it at this stage. So All I am doing is the following:
void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
    HRESULT hr;

    // Clear the render target and the zbuffer 
    V( pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0, 45, 50, 170), 1.0f, 0) );

    // Render the scene
    if( SUCCEEDED( pd3dDevice->BeginScene() ) )
    {
		pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
		Engine::Render(pd3dDevice);
        V( pd3dDevice->EndScene() );
    }
}



the engine Render will loop through the objects and call their rendering function:
void Object::Render(IDirect3DDevice9* device,Scene * parentScene)
{
	D3DXMATRIX identityMatrix;
	D3DXMatrixIdentity(&identityMatrix);
	//device->SetTransform( D3DTS_WORLD, &matWorld );
	device->SetTransform( D3DTS_WORLD, &identityMatrix );
	
	for(DWORD i =0 ; i < NumMaterials; ++i)
	{
		device->SetMaterial( &pMeshMaterials[i] );
		//get the texture:
		int textureIndex = textureIndices[i];
	device->SetTexture(0,parentScene->GetTextureManager()->GetTexture(textureIndex));
		
		localMesh->DrawSubset(i);
	}
}



I debugged and the Textures returned are the ones I need, still I cannot see anything on the screen. All the samples on DXUT load a DX Effect File and run several passes or something like that. All I want to do is a simple rendering of an object, I do not know the structure of the Effect file so is there a way around it?

Share this post


Link to post
Share on other sites

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