DirectX mesh unhandled exception

Started by
15 comments, last by Evil Steve 14 years, 11 months ago
Hi,

1-) Did you set transform states?
YourD3DDevice->SetTransform (D3DTS_WORLD, &yourModelsWorldMatrix);YourD3DDevice->SetTransform (D3DTS_VIEW, &yourViewMatrix);YourD3DDevice->SetTransform (D3DTS_PROJECTION, &yourProjMatrix);


2-) It will be better if you use an ambient and a shading state.
YourD3DDevice->SetRenderState (D3DRS_AMBIENT, 0xFFFFFFFF); //whiteYourD3DDevice->SetRenderState (D3DRS_SHADEMODE, D3DSHADE_GOURAUD);


Hope this helps.
Regards,
Rohat.
There's no "hard", and "the impossible" takes just a little time.
Advertisement
Well... I've set both the view and projection transforms, but those are set in my camera.cpp. But, I didn't set the world transform, becuase I'm holding off making that transform until I'm ready to rotate, translate, and scale my mesh.

But first I need to render it.

Do I need the transform world, just to render it?
I'm a Christian!!!
If you don't use any world transform, DirectX will asuume that world transform is done with an identity matrix. So, your mesh would be positioned at origin, looking at +z direction.
There's no "hard", and "the impossible" takes just a little time.
The debug runtimes are your friend.
Okay, now that I've had some sleep and am rested up...

First-chance exception at 0x779d42eb in Cell Engine.exe: Microsoft C++ exception: long at memory location 0x002ff710..


Okay, okay... I debugged this. And found that it pops up in the draw method. It says this every time the code goes through DrawSubset(i);
Since my mesh has 3 subsets, it does this 3 times per frame.

It says the like a million times during runtime.
I'm a Christian!!!
Yes!!!!!!!!!!!!!!!!!!!!!!!!

Eight hours of staring at a computer, and I finally got it to render!!!!
Stupid me!!!!




I encapselated my renderStart() and renderStop() functions into renderFrame().
Then in WinMain, I called renderFrame() and then mesh->draw().


The mesh wasn't drawing because the endScene function had already been called...



Now, I can die......






Edit: Okay, so why do I have to put the whole adress of my mesh, and how can I get the project to be set in the proper directory?
I'm a Christian!!!
Quote:Original post by Dual Op Amp
Edit: Okay, so why do I have to put the whole adress of my mesh, and how can I get the project to be set in the proper directory?
You don't have to put the whole path in, but it's best to eliminate an incorrect path as a possible source of error.
You could just load "Foo.x" if the file was in the same directory as the working directory. When running in visual studio, the working director is set to that of your solution (or project, I'm not sure which - I always put them in the same directory) - although you can change that in the project properties, and when run from explorer by double-clicking the EXE, the working directory is the same directory as the EXE.

This topic is closed to new replies.

Advertisement