Jump to content
  • Advertisement
Sign in to follow this  
Pirosan

Getting certain verticies from mesh

This topic is 5151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
Change (LPVOID*)&pVertList to (LPVOID)&pVertList

LPVOID is defined as (void*), so your code translated to (void**) &pVertList

Share this post


Link to post
Share on other sites
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** ...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
well i tried (BYTE**)&pVertList) and it accepts it, though the program dies immediatly at startup... any ideas why this would be?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yeh sure, I have a crystal ball here.

Use the debugger.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!