Added ability to read occlusion query result on main thread.

This commit is contained in:
Branimir Karadžić
2015-11-03 16:00:14 -08:00
parent a5bbb18a25
commit ecf7eba043
11 changed files with 111 additions and 39 deletions

View File

@@ -212,6 +212,8 @@ class Occlusion : public entry::AppI
bgfx::touch(0);
bgfx::touch(2);
uint8_t img[CUBES_DIM*CUBES_DIM*2];
for (uint32_t yy = 0; yy < CUBES_DIM; ++yy)
{
for (uint32_t xx = 0; xx < CUBES_DIM; ++xx)
@@ -246,9 +248,14 @@ class Occlusion : public entry::AppI
bgfx::setCondition(occlusionQuery, true);
bgfx::setState(BGFX_STATE_DEFAULT);
bgfx::submit(2, m_program);
img[(yy*CUBES_DIM+xx)*2+0] = " \xfex"[bgfx::getResult(occlusionQuery)];
img[(yy*CUBES_DIM+xx)*2+1] = 0xf;
}
}
bgfx::dbgTextImage(5, 5, CUBES_DIM, CUBES_DIM, img, CUBES_DIM*2);
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();