[SOLVED] DrawVertexPrimitiveList not working
Posted: Sat Jun 23, 2012 7:05 pm
Hi everyone, here's a code snippet used to render a cube adapted from a DirectX sample, but it doesn't work with Irrlicht using either (DX or OpenGL) drivers:
This shows some random triangles being rendered, but it's like it doesn't follow the index order
What's funny, this function never works as its supposed to, and given the poor documentation (in particular regarding the 4th parameter) this is driving me nuts.
Help anyone?
Code: Select all
irr::video::S3DVertex vertices[8] =
{
irr::video::S3DVertex(vector3df(-30.0f, 30.0f, -30.0f), vector3df(), SColor(255, 0, 0, 255), vector2df()),
irr::video::S3DVertex(vector3df(30.0f, 30.0f, -30.0f), vector3df(), SColor(255, 0, 255, 0), vector2df()),
irr::video::S3DVertex(vector3df(-30.0f, -30.0f, -30.0f), vector3df(), SColor(255, 255, 0, 0), vector2df()),
irr::video::S3DVertex(vector3df(30.0f, -30.0f, -30.0f), vector3df(), SColor(255, 0, 255, 255), vector2df()),
irr::video::S3DVertex(vector3df(-30.0f, 30.0f, 30.0f), vector3df(), SColor(255, 0, 0, 255), vector2df()),
irr::video::S3DVertex(vector3df(30.0f, 30.0f, 30.0f), vector3df(), SColor(255, 255, 0, 0), vector2df()),
irr::video::S3DVertex(vector3df(-30.0f, -30.0f, 30.0f), vector3df(), SColor(255, 0, 255, 0), vector2df()),
irr::video::S3DVertex(vector3df(30.0f, -30.0f, 30.0f), vector3df(), SColor(255, 0, 255, 255), vector2df())
};
int indices[36] =
{
0, 1, 2, // side 1
2, 1, 3,
4, 0, 6, // side 2
6, 0, 2,
7, 5, 6, // side 3
6, 5, 4,
3, 1, 7, // side 4
7, 1, 5,
4, 5, 0, // side 5
0, 5, 1,
3, 7, 2, // side 6
2, 7, 6,
};
driver->drawVertexPrimitiveList(&vertices[0], 8, &indices[0], 12, irr::video::EVT_STANDARD, irr::scene::EPT_TRIANGLES);
What's funny, this function never works as its supposed to, and given the poor documentation (in particular regarding the 4th parameter) this is driving me nuts.
Help anyone?