Getting certain verticies from mesh
Well, i looked around and found a sample on how to lock the mesh then get the data and it isnt working...
The code is:
D3DXVECTOR3 *pVertList;
m_pMesh->LockVertexBuffer(D3DLOCK_READONLY | D3DLOCK_NOSYSLOCK, (LPVOID*)&pVertList);
intersectO.v1 = pVertList[dwFace * 3];
intersectO.v2 = pVertList[dwFace * 3 + 1];
intersectO.v3 = pVertList[dwFace * 3 + 2];
m_pMesh->UnlockVertexBuffer();
and it returns that on this line:
m_pMesh->LockVertexBuffer(D3DLOCK_READONLY | D3DLOCK_NOSYSLOCK, (LPVOID*)&pVertList);
cannot convert parameter 2 from 'void ** ' to 'unsigned char ** '
so, i know there is a simple answer, but i just cant get it >.<
anyone know how to go about this?
Change (LPVOID*)&pVertList to (LPVOID)&pVertList
LPVOID is defined as (void*), so your code translated to (void**) &pVertList
LPVOID is defined as (void*), so your code translated to (void**) &pVertList
It's not the pointer cast that is causing trouble, it's the type of pointer. you'd need (unsigned char**)&pVerts.
But I dont know why it should do that, LockVertexBuffer expects a void** not an unsigned char** ...
But I dont know why it should do that, LockVertexBuffer expects a void** not an unsigned char** ...
Oops, I messed up there. Yeah, it expects a void**. Those damn LP keywords always mess me up.
Yeah, I don't see where the unsigned char part is even coming from.
Yeah, I don't see where the unsigned char part is even coming from.
well i tried (BYTE**)&pVertList) and it accepts it, though the program dies immediatly at startup... any ideas why this would be?
Quote:Original post by Pirosan
well i tried (BYTE**)&pVertList) and it accepts it, though the program dies immediatly at startup... any ideas why this would be?
verify/validate the value of dwFace
Nahh, there's something wrong. What SDK version are you using? I can't remember if the old stuff accepted char pointers or not.
In any case, if you're using version 9c (as I am), then I would shut down your computer and buy a cross to wear around your neck. But before that, make sure you're using the correct includes and libraries for your version of DirectX.
In any case, if you're using version 9c (as I am), then I would shut down your computer and buy a cross to wear around your neck. But before that, make sure you're using the correct includes and libraries for your version of DirectX.
Some older SDK's used BYTE (unsigned char) pointers. I'm thinking 8 did, I know 5 did...not much more than this I know. I agree with Jiia. I bet it's an include problem. Maybe you had a previous version of the SDK on your computer? Or you're using an old SDK and know it but looking at an example used with a newer SDK.
Chris
Chris
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement