improved calling OpenGL function when there is no OGL context.

This commit is contained in:
rachytski 2013-02-08 14:14:29 +03:00 committed by Alex Zolotarev
parent 9f3b8cbfe3
commit 3e090e225f

View file

@ -89,7 +89,13 @@ namespace graphics
m_isUsingMapBuffer = true;
makeCurrent();
OGLCHECK(glBufferDataFn(m_target, m_size, 0, GL_DYNAMIC_DRAW));
m_gpuData = glMapBufferFn(m_target, GL_WRITE_ONLY_MWM);
if (graphics::gl::g_hasContext)
m_gpuData = glMapBufferFn(m_target, GL_WRITE_ONLY_MWM);
else
{
m_gpuData = 0;
LOG(LINFO, ("no OGL context. skipping OGL call"));
}
OGLCHECKAFTER;
if (m_gpuData != 0)
@ -116,10 +122,14 @@ namespace graphics
if (g_isMapBufferSupported && m_isUsingMapBuffer)
{
if (glUnmapBufferFn(m_target) == GL_FALSE)
LOG(LWARNING, ("glUnmapBuffer returned GL_FALSE!"));
OGLCHECKAFTER;
if (graphics::gl::g_hasContext)
{
if (glUnmapBufferFn(m_target) == GL_FALSE)
LOG(LWARNING, ("glUnmapBuffer returned GL_FALSE!"));
OGLCHECKAFTER;
}
else
LOG(LINFO, ("no OGL context. skipping OGL call."));
}
else
{