now in the vertexbuffer for drawing the LINELIST i have the x,y,z of the first of 3 indices , the problem is the line is way of the mark that represents to vertex point
here is a pic and video
i thought locking in a new thread would be alot quicker
http://img266.images...apotlockrx6.jpg
DWORD LockThread(LPDWORD lpdwParam)
{
Start:
BYTE* lpbVb;
BYTE *lpIB; //8 bits
//short *lpIB; //16 bits
//get the vertex buffer
static HRESULT cHresult;
if(FishMesh)
{
cHresult = meshTeapot->LockVertexBuffer( D3DLOCK_READONLY, (VOID**)&lpbVb );
}
if(cHresult == D3D_OK)
{
sprintf(data , "%s \n" , "locked vertex buffer success");
WriteConsole(Console , data , strlen(data) , &written , NULL);
}
Sleep(2000);
if(meshTeapot)
{
cHresult = meshTeapot->LockIndexBuffer ( D3DLOCK_READONLY, (VOID**)&lpIB);
}
if(cHresult == D3D_OK)
{
sprintf(data , "%s \n" , "locked index buffer success");
WriteConsole(Console , data , strlen(data) , &written , NULL);
}
Sleep(500);
cHresult = meshTeapot->GetIndexBuffer( &lpIndexBuffer );
if(cHresult == D3D_OK)
{
sprintf(data , "%s \n" , "got desc success");
WriteConsole(Console , data , strlen(data) , &written , NULL);
}
Sleep(500);
cHresult = lpIndexBuffer->GetDesc( &ibdesc );
if(cHresult == D3D_OK)
{
//MessageBox(NULL,"GetDesc Success","",0);
}
if(ibdesc.Format == D3DFMT_INDEX32)
{
//MessageBox(NULL,"ibdesc.Format 32","",0);
numIndices = ibdesc.Size / sizeof(DWORD);
}
else
{
//MessageBox(NULL,"ibdesc.Format 16","",0);
numIndices = ibdesc.Size / sizeof(WORD);
}
Sleep(500);
sprintf(data , "%s %d \n" , "numIndices" , numIndices);
WriteConsole(Console , data , strlen(data) , &written , NULL);
numBytesPerVertex = meshTeapot->GetNumBytesPerVertex();
//Sleep(500);
sprintf(data , "%s %d \n" , "numBytesPerVertex" , numBytesPerVertex);
WriteConsole(Console , data , strlen(data) , &written , NULL);
Sleep(100);
//sprintf(data , "%s %d \n" , "numIndices" , numIndices);
//WriteConsole(Console , data , strlen(data) , &written , NULL);
for(int i=0; i<numIndices; i += 3 )
{
sprintf(data , "%s %d \n" , "i" , i);
WriteConsole(Console , data , strlen(data) , &written , NULL);
//Sleep(5);
if (ibdesc.Format == D3DFMT_INDEX32 )
{
idxVbVert0 = ((DWORD*)lpIB)[ i ];
idxVbVert1 = ((DWORD*)lpIB)[ i+1 ];
idxVbVert2 = ((DWORD*)lpIB)[ i+2 ];
//sprintf(data , "%s \n" , "format is 32");
//WriteConsole(Console , data , strlen(data) , &written , NULL);
}
else
{
//sprintf(data , "%s \n" , "format is 16");
//WriteConsole(Console , data , strlen(data) , &written , NULL);
idxVbVert0 = ((WORD*)lpIB)[ i ];
idxVbVert1 = ((WORD*)lpIB)[ i+1 ];
idxVbVert2 = ((WORD*)lpIB)[ i+2 ];
}
v0 = *(D3DXVECTOR3*) &lpbVb[ idxVbVert0 * numBytesPerVertex ];
v1 = *(D3DXVECTOR3*) &lpbVb[ idxVbVert1 * numBytesPerVertex ];
v2 = *(D3DXVECTOR3*) &lpbVb[ idxVbVert2 * numBytesPerVertex ];
D3DXVec3TransformCoord( &worldBounds[0], &v0, &matMove );
D3DXVec3TransformCoord( &worldBounds[1], &v1, &matMove );
D3DXVec3TransformCoord( &worldBounds[2], &v2, &matMove );
sprintf(data , "%s %f \n" , "worldBounds[0].x" , worldBounds[0].x);
WriteConsole(Console , data , strlen(data) , &written , NULL);
sprintf(data , "%s %f \n" , "worldBounds[0].y" , worldBounds[0].y);
WriteConsole(Console , data , strlen(data) , &written , NULL);
sprintf(data , "%s %f \n" , "worldBounds[0].z" , worldBounds[0].z);
WriteConsole(Console , data , strlen(data) , &written , NULL);
}
//Unlock()
meshTeapot->UnlockVertexBuffer();
meshTeapot->UnlockIndexBuffer();
sprintf(data , "%s\n" , "unlocked");
WriteConsole(Console , data , strlen(data) , &written , NULL);
Sleep(5000);
goto Start;
return 0;
}













