Skip to main content
GameDev.net gamedev.net
🔒 Locked

error using GenerateAdjacency

Started by Locutusborg Oct 4, 2008 at 1:00 AM 0 replies 2k views
Original Post
Locutusborg
Locutusborg
Hello, I am trying to optimize my mesh files, however, I can't get the adjacency buffer to work. I get the folllowing error message every time I use the GenerateAdjacency command: First-chance exception at 0x77c17631 in 2d.exe: 0xC0000005: Access violation writing location 0x00376000. Unhandled exception at 0x77c17631 in 2d.exe: 0xC0000005: Access violation writing location 0x00376000. Here is the code I use

Create an adjacency buffer
    LPD3DXBUFFER pAdjacencyBuffer = NULL;
    D3DXCreateBuffer( g_pMesh[m]->GetNumFaces() * 3, &pAdjacencyBuffer );

// Using a vertex positional tolerance of 0.0f, ask the mesh for its
// adjacency information.
g_pMesh[m]->GenerateAdjacency( 0.0f, (DWORD*)pAdjacencyBuffer->GetBufferPointer() );

    // Now, tell the mesh to attempt an optimization based on that 
    // adjacency information.
if(FAILED(g_pMesh[m]->OptimizeInplace( D3DXMESHOPT_ATTRSORT | D3DXMESHOPT_COMPACT | D3DXMESHOPT_VERTEXCACHE | D3DXMESHOPT_STRIPREORDER, (DWORD*)pAdjacencyBuffer->GetBufferPointer(), NULL, NULL, NULL ) ) 
{
MessageBox(NULL, "Could not optimize" ,meshnaam[m] , MB_OK);
return E_FAIL;
}
if( pAdjacencyBuffer != NULL )
pAdjacencyBuffer->Release();

Any help in solving this would be greatly appreciated
roonda
roonda

D3DXCreateBuffer( g_pMesh[m]->GetNumFaces() * 3, &pAdjacencyBuffer );


Probably need to use "[font=monospace]g_pMesh[m]->GetNumFaces() * 3 * sizeof(DWORD)"[/font]

I realise this is a really old thread, but I found it because I have a different problem using GenerateAdjacency(). My problem is that I'm getting "heap corruption", but I'm sure my heap is not corrupted (I know, that's what they all say ;)).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.