Hopefully fix the OpenGL context switching error

This commit is contained in:
James Seibel
2021-09-30 21:41:49 -05:00
parent b1995445e2
commit 536bff2fe7
@@ -549,10 +549,17 @@ public class LodBufferBuilder
try
{
// make sure we are uploading to a different OpenGL context,
// make sure we are uploading to the builder context,
// to prevent interference (IE stuttering) with the Minecraft context.
glProxy.setGlContext(GlProxyContext.LOD_BUILDER);
// But only set the context once, we don't need to set it multiple times.
if (glProxy.getGlContext() != GlProxyContext.LOD_BUILDER)
{
glProxy.setGlContext(GlProxyContext.LOD_BUILDER);
ClientProxy.LOGGER.info(Thread.currentThread().getName() + ": setting OpenGL context to: [" + GlProxyContext.LOD_BUILDER + "]");
}
// actually upload the buffers
for (int x = 0; x < buildableVbos.length; x++)
{
for (int z = 0; z < buildableVbos.length; z++)
@@ -574,11 +581,6 @@ public class LodBufferBuilder
ClientProxy.LOGGER.error(LodBufferBuilder.class.getSimpleName() + " - UploadBuffers failed: " + e.getMessage());
e.printStackTrace();
}
finally
{
// make sure the context is disabled
glProxy.setGlContext(GlProxyContext.NONE);
}
}
/**