From e7bea07c82dbca17e0d576593865ba8023b2bd27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 28 Oct 2017 20:49:55 -0700 Subject: [PATCH] Switching 17-drawstress to use encoder API. --- examples/17-drawstress/drawstress.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/17-drawstress/drawstress.cpp b/examples/17-drawstress/drawstress.cpp index aa2a9bf91..642b193d0 100644 --- a/examples/17-drawstress/drawstress.cpp +++ b/examples/17-drawstress/drawstress.cpp @@ -279,6 +279,8 @@ public: pos[1] = -step*m_dim / 2.0f; pos[2] = -15.0; + bgfx::Encoder* encoder = bgfx::begin(); + for (uint32_t zz = 0; zz < uint32_t(m_dim); ++zz) { for (uint32_t yy = 0; yy < uint32_t(m_dim); ++yy) @@ -296,21 +298,23 @@ public: mtx[14] = pos[2] + float(zz)*step; // Set model matrix for rendering. - bgfx::setTransform(mtx); + encoder->setTransform(mtx); // Set vertex and index buffer. - bgfx::setVertexBuffer(0, m_vbh); - bgfx::setIndexBuffer(m_ibh); + encoder->setVertexBuffer(0, m_vbh); + encoder->setIndexBuffer(m_ibh); // Set render states. - bgfx::setState(BGFX_STATE_DEFAULT); + encoder->setState(BGFX_STATE_DEFAULT); // Submit primitive for rendering to view 0. - bgfx::submit(0, m_program); + encoder->submit(0, m_program); } } } + bgfx::end(encoder); + // Advance to next frame. Rendering thread will be kicked to // process submitted rendering primitives. bgfx::frame();