RenderBuffer: Fixed BufferMapping OpenGL Errors
Thanks to nev at discord for pointing this issue out.
This commit is contained in:
+7
-3
@@ -817,6 +817,8 @@ public class LodBufferBuilderFactory
|
||||
{
|
||||
// this is how many points will be rendered
|
||||
vbo.vertexCount = (uploadBuffer.capacity() / LodUtil.LOD_VERTEX_FORMAT.getByteSize());
|
||||
// If size is zero, just ignore it.
|
||||
if (uploadBuffer.capacity()==0) return;
|
||||
|
||||
GL32.glBindBuffer(GL32.GL_ARRAY_BUFFER, vbo.id);
|
||||
try
|
||||
@@ -839,9 +841,10 @@ public class LodBufferBuilderFactory
|
||||
// Unless the user is running integrated graphics,
|
||||
// in that case this will actually work better than SUB_DATA.
|
||||
long size = GL32.glGetBufferParameteri(GL32.GL_ARRAY_BUFFER, GL32.GL_BUFFER_SIZE);
|
||||
if (size < uploadBuffer.capacity() * BUFFER_EXPANSION_MULTIPLIER)
|
||||
if (size < uploadBuffer.capacity())
|
||||
{
|
||||
GL32.glBufferData(GL32.GL_ARRAY_BUFFER, (int) (uploadBuffer.capacity() * BUFFER_EXPANSION_MULTIPLIER), GL32.GL_STATIC_DRAW);
|
||||
int newSize = (int) (uploadBuffer.capacity()*BUFFER_EXPANSION_MULTIPLIER);
|
||||
GL32.glBufferData(GL32.GL_ARRAY_BUFFER, newSize, GL32.GL_STATIC_DRAW);
|
||||
}
|
||||
ByteBuffer vboBuffer;
|
||||
// map buffer range is better since it can be explicitly unsynchronized
|
||||
@@ -865,7 +868,8 @@ public class LodBufferBuilderFactory
|
||||
long size = GL32.glGetBufferParameteri(GL32.GL_ARRAY_BUFFER, GL32.GL_BUFFER_SIZE);
|
||||
if (size < uploadBuffer.capacity() * BUFFER_EXPANSION_MULTIPLIER)
|
||||
{
|
||||
GL32.glBufferData(GL32.GL_ARRAY_BUFFER, (int) (uploadBuffer.capacity() * BUFFER_EXPANSION_MULTIPLIER), GL32.GL_STATIC_DRAW);
|
||||
int newSize = (int)(uploadBuffer.capacity()*BUFFER_EXPANSION_MULTIPLIER);
|
||||
GL32.glBufferData(GL32.GL_ARRAY_BUFFER, newSize, GL32.GL_STATIC_DRAW);
|
||||
}
|
||||
GL32.glBufferSubData(GL32.GL_ARRAY_BUFFER, 0, uploadBuffer);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.lwjgl.opengl.GL;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL32;
|
||||
import org.lwjgl.opengl.GLCapabilities;
|
||||
import org.lwjgl.opengl.GLUtil;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
@@ -204,7 +205,6 @@ public class GLProxy
|
||||
lodBuilderGlCapabilities = GL.createCapabilities();
|
||||
ClientApi.LOGGER.info("lodBuilderGlCapabilities:\n"+getVersionInfo(lodBuilderGlCapabilities));
|
||||
|
||||
|
||||
// create the proxyWorker's context
|
||||
proxyWorkerGlContext = GLFW.glfwCreateWindow(64, 48, "LOD proxy worker Window", 0L, minecraftGlContext);
|
||||
GLFW.glfwMakeContextCurrent(proxyWorkerGlContext);
|
||||
@@ -224,8 +224,8 @@ public class GLProxy
|
||||
//==================================//
|
||||
|
||||
setGlContext(GLProxyContext.LOD_BUILDER);
|
||||
|
||||
|
||||
// TODO: Enable this but disable INFO logging
|
||||
//GLUtil.setupDebugMessageCallback();
|
||||
|
||||
// get specific capabilities
|
||||
// Check if we can use the Buffer Storage, which is available in GL4.4 or after
|
||||
@@ -250,6 +250,10 @@ public class GLProxy
|
||||
}
|
||||
|
||||
ClientApi.LOGGER.info("GPU Vendor [" + vendor + "], Preferred upload method is [" + preferredUploadMethod + "].");
|
||||
|
||||
setGlContext(GLProxyContext.PROXY_WORKER);
|
||||
// TODO: Enable this but disable INFO logging
|
||||
//GLUtil.setupDebugMessageCallback();
|
||||
|
||||
//==========//
|
||||
// clean up //
|
||||
|
||||
Reference in New Issue
Block a user