Sign in to follow this  
VoidChoice

What is going on with CD3DMesh...

Recommended Posts

these CD3DMesh's??? I have just started learning to program with DX9...I have looked at the sample sources but i am insistant that if microsoft have created a class called "CD3DMesh" then surely this is a wrapper for a mesh? Because I am learning I am first looking for the simplest thing to do something, i want to load a mesh and view it so... I have created a directx9 application with appwizard...and i have created a member variable m_pMesh of this class... ive created it in CMyD3DApplication::InitDeviceObjects() destroyed it in DeleteDeviceObjects() and deleted it in FinalCleanup() I know this may be wrong but shouldnt be the problem... Im rendering it in the scene if tried all combinations of the 2 bools but it still doesnt work now...either i am missing a vital function call or two to get this to show...and would like help with what they are... ive also moved the camera around to see if it was out of view but i got nothing OR this class is not fully implemented or doesnt do what it says...i mean...a mesh class...should have everything you need to show a mesh shouldnt it? Ive looked the usual places for some answers but none...someone please give me the lowdown on this :D VC [Edited by - Coder on August 18, 2004 10:26:27 AM]

Share this post


Link to post
Share on other sites
There are many reasons why a 3D object cannot be drawn. Some reasons include
- no projection matrix
- world matrix not identity
- Lighting is on
- page flipping problem
- Invalid mesh

To narrow down the problem try to draw a triangle at (0,0,0). If you can see it then you know that it is that the mesh isn't being loaded correctly. If you can't see it mess with the matricies until you can see it.

Share this post


Link to post
Share on other sites
if you are just learning DO NOT USE THE APPWIZARD, you'll have no idea what the hell is going on. and loading a mesh and viewing it probly is not the simplest thing, createing a d3d device and clearing the screen withouth useing copy and paste would probly be a better start, then getting a 2d polygon, then a textured 2d polygon, then a textured 3d polygon, then start worriing about stuff more complicated than that, in particular the 2d to 3d step will probly be the most chalenging, becose you have to master the 'ole matrix class.

Share this post


Link to post
Share on other sites
thanks for your support...The truth is tho that its typical, once i post about a problem i end up solving it straight away even if i spent days on it :(

Anyway, i did fix it, i should of payed attention to the error codes, cd3dMesh->Render was returning an error because the m_pLocalMesh was null...i checked the create function and this only creates the m_pMysMemMesh...

So how should i go about doing this? for now i have just cloned SysMem to Local and it works but is this the best or correct way of doing this? should i set up m_pLocalMesh the same way the Create() function sets up the SysMemMesh? I'm finding the dx9sdk documentation to be not very helpful :((

Share this post


Link to post
Share on other sites
Check out the new DirectX9.0c Common directory (all samples project include it). The files DXUTMesh.cpp DXUTmesh.h and some part of DXUTmisc are an excellent way to load a complex direct x file (animation excluded).
Simply use the CDXUTMeshFile class, it has all you need: Load and render mainly.
(assuming you have a working framework with view and projection set of course)
They even handle transparent materail correctly (by rendering diffuse with alpha in a second loop)
Hope that helps.
CaptainZ

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