mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-19 21:42:59 +01:00
VR: Fix skewed viewports with buffered eye textures
Bug fix for #419 Viewport calculations need to take VR eye buffer size into account. Noticable at the older 100px boundary. Skewing still exists at newer 8px buffer, but is harder to notice. Eventually causes pretty bad eye strain, though. Easily reproduced by setting the buffer to something obscenely large, such as 2048.
This commit is contained in:
@@ -4955,8 +4955,17 @@ namespace bgfx { namespace gl
|
||||
GL_CHECK(glInsertEventMarker(0, viewName) );
|
||||
}
|
||||
|
||||
viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2;
|
||||
viewState.m_rect.m_width /= 2;
|
||||
#if BGFX_CONFIG_USE_OVR
|
||||
if (m_ovr.isEnabled())
|
||||
{
|
||||
m_ovr.getViewport(eye, &viewState.m_rect);
|
||||
}
|
||||
else
|
||||
#endif // BGFX_CONFIG_USE_OVR
|
||||
{
|
||||
viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2;
|
||||
viewState.m_rect.m_width /= 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user