when I compile and link SkinnedMesh sample in sdk,err appear.

Started by
7 comments, last by Evil Steve 19 years ago
when I use debug mode,Unexpected error encountered. line:928 error code:unkonwn 0x80040903 when I use release mode,Could not find required media.
Advertisement
That's rough. Do you have a question or are you just posting the error codes for our information.

Sory, sory. I don't want to be mean, but if you want some help you are going to have to do a little more work.

Try some of these things:

1. Research your problem before just dumping the error codes here.
2. In your research try to to figure out any possible causes or solutions to your problem.
3. Using the knowledge gained in your research try to fix your problem.

Steps 1 - 3 should solve 90% of your problems, if your problem is not solved by this point continue on to step 4.

4. Formulate a queston detailing your problem and the previous research you have done to try and solve your problem. Try and communicate everything you think is revelent without just dumping your code or your errors. Make sure you ask a question. If you have difficulty with english consider using a translation service, getting an english speaker to help you translate or posting in your native language.
your suggestion is excellent and basic.let me repeat.
1,do some research -I do ,but beyond my capability much .
2,figure out any possible cause.-I do,it may be d3d sample error I think, or I mis-install d3d
3,try to fix -I do,I use release mode and debug mode and found problem is different.
4,formulate question and detail problem and research I do before.

the question :SkinnedMesh in DirectX sample run error

I install project SkinnnedMesh in DirectX sample,and just compile and link.so far is ok.but when I run it,err appear.
I think may be sample error or mis-compatible my vc 2003.but may not d3d problem
because SkinnnedMesh program provided by microsoft is ok.

Quote:Original post by derek7
when I use release mode,Could not find required media.


That would imply that it can't find the required media. The samples assume a specific directory structure so that they can all find the various media files needed (images, sounds, etc.). Make sure the parts of the code that try to load said media are looking in the right location. Or make sure that you put the media files in the location expected by the application.


In the future, please at least post the actual source for the line where the occurs (and maybe a few lines around it for context). "line: 928" means nothing to someone who doesn't have your code in front of them.
sorry .
the project SkinnedMesh is DirectX sample .any one which setup DirectX could have this sample source code .it is long ,so it is inconvenience to post here.just post line 923 is not enough maybe

I use "install project" provided by DirectX to install the sample.so the required files maybe copy to correct position.

so I want to know it is DirectX problem or myself.

do you have meet this problem???
Installing the sample project doesn't install the media files (at least I don't think it does).

Yes, I have encountered situations where my application couldn't load a file. It was usually because I hadn't put it in the correct place. That's why I suggested that you make sure the files are all where they should be. It doesn't sound like you've done that.

As for the source being long, I didn't mean to post the entire project. Just the few lines around where you are getting the error. And not everyone has the samples installed, nor does everyone necessarily have the same version that you do. People have much better things to do than digging around looking for what may or may not be the same code you are having trouble with.

I'm trying to help, but you've got to work with me. :)
HRESULT CALLBACK OnCreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc ){    HRESULT hr;    CAllocateHierarchy Alloc;    // Initialize the font    V_RETURN( D3DXCreateFont( pd3dDevice, 15, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET,                          OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,                          L"Arial", &g_pFont ) );    // Define DEBUG_VS and/or DEBUG_PS to debug vertex and/or pixel shaders with the     // shader debugger. Debugging vertex shaders requires either REF or software vertex     // processing, and debugging pixel shaders requires REF.  The     // D3DXSHADER_FORCE_*_SOFTWARE_NOOPT flag improves the debug experience in the     // shader debugger.  It enables source level debugging, prevents instruction     // reordering, prevents dead code elimination, and forces the compiler to compile     // against the next higher available software target, which ensures that the     // unoptimized shaders do not exceed the shader model limitations.  Setting these     // flags will cause slower rendering since the shaders will be unoptimized and     // forced into software.  See the DirectX documentation for more information about     // using the shader debugger.    DWORD dwShaderFlags = 0;    #ifdef DEBUG_VS        dwShaderFlags |= D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT;    #endif    #ifdef DEBUG_PS        dwShaderFlags |= D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT;    #endif    // Read the D3DX effect file    WCHAR str[MAX_PATH];    V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"SkinnedMesh.fx" ) );    // If this fails, there should be debug output as to     // they the .fx file failed to compile    V_RETURN( D3DXCreateEffectFromFile( pd3dDevice, str, NULL, NULL, dwShaderFlags,                                         NULL, &g_pEffect, NULL ) );    // Load the mesh.............."this line is error line"    V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, MESHFILENAME ) );    WCHAR strPath[MAX_PATH];    StringCchCopy( strPath, MAX_PATH, str );    WCHAR* pLastSlash = wcsrchr( strPath, L'\\' );    if( pLastSlash )        *pLastSlash = 0;    WCHAR strCWD[MAX_PATH];    GetCurrentDirectory( MAX_PATH, strCWD );    SetCurrentDirectory( strPath );    V_RETURN( D3DXLoadMeshHierarchyFromX( str, D3DXMESH_MANAGED, pd3dDevice,                                          &Alloc, NULL, &g_pFrameRoot, &g_pAnimController ) );    V_RETURN( SetupBoneMatrixPointers( g_pFrameRoot ) );    V_RETURN( D3DXFrameCalculateBoundingSphere( g_pFrameRoot, &g_vObjectCenter, &g_fObjectRadius ) );    SetCurrentDirectory( strCWD );    // Obtain the behavior flags    D3DDEVICE_CREATION_PARAMETERS cp;    pd3dDevice->GetCreationParameters( &cp );    g_dwBehaviorFlags = cp.BehaviorFlags;    return S_OK;}


just you said,maybe file is not at correct position.
because I comile and link source just at DirectX directory,not use "copy project" to copy to myself directory.

I denote the "error line"at source code.
That would indicate that it can't find the mesh file specified by the variable/macro MESHFILENAME. Find out what MESHFILENAME is set to and make sure you have that file in the correct location.
#define MESHFILENAME L"tiny\\tiny.x"
Make sure that the mesh is in the correct place.

If you use a debugger to trace into the calls, you can see it opens the registry key Software\Microsoft\DirectX SDK and reads the DX9O4SDK Samples Path value to determine where the media directory is.
So you've probably not installed the SDK properly, or you installed it to one directory and then moved it.

This topic is closed to new replies.

Advertisement