Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#ActualMedo3337

Posted 16 May 2013 - 08:28 PM

 
I tried the following code, but it's not working as expected:
// Create index buffer
DWORD* index = new DWORD[indicesCount];
DWORD j = 0;
indexBuffer->Lock(0, sizeof(index), (void**)&index, 0);
for(USHORT i = 0; i < indicesCount; i += 6)
{
    index[0+i] = 0+j;
    index[1+i] = 2+j;
    index[2+i] = 1+j;
    index[3+i] = 0+j;
    index[4+i] = 3+j;
    index[5+i] = 2+j;
    j += 4;
}
indexBuffer->Unlock();

 

// Draw
device->DrawIndexedPrimitiveUP( D3DPT_TRIANGLELIST, 0, 4, 2, indexBuffer, D3DFMT_INDEX32, vrts, sizeof( TVertex ) );

 

What's wrong?


#2Medo3337

Posted 16 May 2013 - 08:27 PM

 
I tried the following code, but it's not working as expected:
// Create index buffer
DWORD* index = new DWORD[indicesCount];
DWORD j = 0;
indexBuffer->Lock(0, sizeof(index), (void**)&index, 0);
for(USHORT i = 0; i < indicesCount; i += 6)
{
    index[0+i] = 0+j;
    index[1+i] = 2+j;
    index[2+i] = 1+j;
    index[3+i] = 0+j;
    index[4+i] = 3+j;
    index[5+i] = 2+j;
    j += 4;
}
indexBuffer->Unlock();

 

 

// Draw
device->DrawIndexedPrimitiveUP( D3DPT_TRIANGLELIST, 0, 4, 2, indexBuffer, D3DFMT_INDEX32, vrts, sizeof( TVertex ) );

What's wrong?


#1Medo3337

Posted 16 May 2013 - 08:18 PM

 
I tried the following code, but it's not working as expected:
// Create index buffer
DWORD* index = new DWORD[indicesCount];
DWORD j = 0;
indexBuffer->Lock(0, sizeof(index), (void**)&index, 0);
for(USHORT i = 0; i < indicesCount; i += 6)
{
    index[0+i] = 0+j;
    index[1+i] = 2+j;
    index[2+i] = 1+j;
    index[3+i] = 0+j;
    index[4+i] = 3+j;
    index[5+i] = 2+j;
    j += 4;
}
indexBuffer->Unlock();
// Draw
device->DrawIndexedPrimitiveUP( D3DPT_TRIANGLELIST, 0, 4, 2, indexBuffer, D3DFMT_INDEX32, vrts, sizeof( TVertex ) );

 What's wrong?


PARTNERS