Getting certain verticies from mesh

Started by
11 comments, last by Pirosan 19 years, 7 months ago
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?
Bow before me... for i am l33t!
Advertisement
Change (LPVOID*)&pVertList to (LPVOID)&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** ...
[size=2]aliak.net
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.
well i tried (BYTE**)&pVertList) and it accepts it, though the program dies immediatly at startup... any ideas why this would be?
Bow before me... for i am l33t!
Yeh sure, I have a crystal ball here.

Use the debugger.

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.
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 ByersMicrosoft DirectX MVP - 2005
i am using 8, and i know that all my includes are 8 compatable... I got the code to lock/unlock the mesh data from a forum here in gamedev... maybe i shouldnt use a D3DXVECTOR3 pointer list?

Ill check the face validity, but im pretty sure its correct
Bow before me... for i am l33t!

This topic is closed to new replies.

Advertisement