Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


Am I overwriting the vertex buffer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 monkeyboi   Members   -  Reputation: 188

Like
0Likes
Like

Posted 10 August 2012 - 04:53 PM

#define D3DFVF_MESHVERTEX (D3DFVF_XYZ| D3DFVF_NORMAL| D3DFVF_DIFFUSE)
struct MESHVERTEX
{
D3DXVECTOR3 Pos;
D3DXVECTOR3 Normal;
DWORD rgba;
};
MESHVERTEX* SphereVerts = new MESHVERTEX[iVQuantity];
/*Doing something here*/
BYTE* lpVertices;
m_pDevice->CreateVertexBuffer(iVQuantity * sizeof(MESHVERTEX), D3DUSAGE_WRITEONLY,D3DFVF_MESHVERTEX,D3DPOOL_MANAGED,&m_pVB,0);
m_pVB->Lock( 0, iVQuantity*sizeof(MESHVERTEX), (void**)&lpVertices, 0 );
memcpy( lpVertices, SphereVerts, iVQuantity*sizeof(MESHVERTEX) );
m_pVB->Unlock();

Am I overwriting the buffer? I have an assertion says _BLOCK_TYPE_IS_VAlID(pHead->nBlockUse),when I try to delete m_pVB.

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 31064

Like
0Likes
Like

Posted 10 August 2012 - 07:24 PM

when I try to delete m_pVB

Do you mean with delete m_pVB;?
Your VB wasn't created with new (but SphereVerts was), so you should use:
delete SphereVerts;
and
m_pVB->Release();




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS