Archived

This topic is now archived and is closed to further replies.

Little problem on DX9, and 3dmax files too...

This topic is 5110 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

Hi, i was a little away from DX programming for a while, but im starting some stuff again.. I have a problem, strange problem indeed, My screen seems to refresh only when i move the mouse or hit the keyboard!!! Dunno whats happening. Another stuff thats is boring me is: How can i load a 3DMax Studio model, or convert it to .X model... what is better? where can i get tutorials on the subject and IK and hierarchy... this stuff about 3D files... Thank you. To code is to make things come to life

Share this post


Link to post
Share on other sites
its me again, I was on some debug session and i found the main problem is in my render method, but didnt found why the error is happening!
The message that appears is that an error at 0xc0000005 ocurred, probably pointer problems. I will give some code to you analyze ppl:


void Render()
{
lpd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
lpd3dDevice->BeginScene();


SetRotation();
SetView();
ShowMesh();


lpd3dDevice->EndScene();
lpd3dDevice->Present( NULL, NULL, NULL, NULL );

};


and my Init3D function:

int Init3D()
{
fim = false;
if( (lpD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) == NULL)
return MessageBox(gHwnd, "Erro criando objeto D3D", "DX Error", MB_OK);



if(FAILED(lpD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &DisplayMode)))
{
MessageBox(NULL, "Error setting the display mode.", "Error!", MB_OK);
return false;
}

if(FAILED(lpD3D->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dcaps)))
{
return false;
}




D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = FALSE;
d3dpp.BackBufferWidth = DisplayMode.Width;
d3dpp.BackBufferHeight = DisplayMode.Height;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.BackBufferFormat = DisplayMode.Format;
d3dpp.BackBufferCount = 1;
d3dpp.hDeviceWindow = gHwnd;



if((lpD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, gHwnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&d3dpp, &lpd3dDevice ) ) != D3D_OK)
return MessageBox(gHwnd, "Erro criando objeto D3D", "DX Error", MB_OK);

if(lpd3dDevice == NULL) return MessageBox(gHwnd, "Erro criando objeto D3D", "DX Error", MB_OK);

lpd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE); // Lighting off.
lpd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);// Culling off.
lpd3dDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
LoadMesh("Model.x");
return 0;
};

Please, someone edit this and place the source tags, i dont post here for a long time and dont remember how to do it.. sorry


To code is to make things come to life

Share this post


Link to post
Share on other sites
Hi. So, anyone knows how to use 3dStudioMax models on DX9? and how to fix that problem i described before? I am trying but really dont have any clue of what is causing the problem. Any guess? cya...

To code is to make things come to life

Share this post


Link to post
Share on other sites