Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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: 31021

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