Game Development Community

Bug in GFXDevice::drawWireCube()

by Tom Spilman · in Torque Game Engine Advanced · 04/07/2005 (2:33 pm) · 2 replies

Simple bug in GFXDevice::drawWireCube():

void GFXDevice::drawWireCube( const Point3F &size, const Point3F &pos, const ColorI &color )
{
   setBaseRenderState();

   GFXVertexBufferHandle<GFXVertexPC> verts(GFX, 30, GFXBufferTypeVolatile);
   verts.lock();

   // setup 6 line loops
   U32 vertexIndex = 0;
   for(int i = 0; i < 6; i++)
   {
      for(int j = 0; j < 5; j++)
      {
         int idx = cubeFaces[i][j%4];

         verts[vertexIndex].point = ( cubePoints[idx] * size ) + pos;
         verts[vertexIndex].color = color;
         vertexIndex; //  BUG... should be ++vertexIndex!
      }
   }

About the author

Tom is a programmer and co-owner of Sickhead Games, LLC.


#1
04/07/2005 (2:52 pm)
That fix is already checked in Tom. It might have gone up with the water changes.
Thanks anyway though ;)
#2
04/07/2005 (2:53 pm)
Oops... need to update. =)