01-cubes: Switched to tristrip to test functionality.

This commit is contained in:
Branimir Karadžić
2016-11-26 22:38:47 -08:00
parent d81efe1324
commit 5bda86b702

View File

@@ -27,7 +27,7 @@ struct PosColorVertex
bgfx::VertexDecl PosColorVertex::ms_decl;
static PosColorVertex s_cubeVertices[8] =
static PosColorVertex s_cubeVertices[] =
{
{-1.0f, 1.0f, 1.0f, 0xff000000 },
{ 1.0f, 1.0f, 1.0f, 0xff0000ff },
@@ -39,7 +39,7 @@ static PosColorVertex s_cubeVertices[8] =
{ 1.0f, -1.0f, -1.0f, 0xffffffff },
};
static const uint16_t s_cubeIndices[36] =
static const uint16_t s_cubeTriList[] =
{
0, 1, 2, // 0
1, 3, 2,
@@ -55,6 +55,22 @@ static const uint16_t s_cubeIndices[36] =
6, 3, 7,
};
static const uint16_t s_cubeTriStrip[] =
{
0, 1, 2,
3,
7,
1,
5,
0,
4,
2,
6,
7,
4,
5,
};
class ExampleCubes : public entry::AppI
{
void init(int _argc, char** _argv) BX_OVERRIDE
@@ -93,7 +109,7 @@ class ExampleCubes : public entry::AppI
// Create static index buffer.
m_ibh = bgfx::createIndexBuffer(
// Static data can be passed with bgfx::makeRef
bgfx::makeRef(s_cubeIndices, sizeof(s_cubeIndices) )
bgfx::makeRef(s_cubeTriStrip, sizeof(s_cubeTriStrip) )
);
// Create program from shaders.
@@ -187,7 +203,10 @@ class ExampleCubes : public entry::AppI
bgfx::setIndexBuffer(m_ibh);
// Set render states.
bgfx::setState(BGFX_STATE_DEFAULT);
bgfx::setState(0
| BGFX_STATE_DEFAULT
| BGFX_STATE_PT_TRISTRIP
);
// Submit primitive for rendering to view 0.
bgfx::submit(0, m_program);