lower opengl requirement to 2.1 when higher versions are unsupported #21

Closed
rdh wants to merge 10 commits from rdh/celeritas:stonecutter into stonecutter
pull from: rdh/celeritas:stonecutter
Showing only changes of commit cd8d8ea5a5 - Show all commits
@@ -10,6 +10,8 @@ import org.embeddedt.embeddium.impl.gl.util.EnumBitField;
import org.embeddedt.embeddium.impl.gl.util.VAOUtil;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.opengl.*;
import org.lwjgl.system.libc.LibCString;
import java.nio.ByteBuffer;
public class GLRenderDevice implements RenderDevice {
@@ -116,20 +118,19 @@ public class GLRenderDevice implements RenderDevice {
return;
}
this.bindBuffer(GlBufferTarget.ARRAY_BUFFER, src);
ByteBuffer srcData = GL15C.glMapBuffer(GL15C.GL_ARRAY_BUFFER, GL15C.GL_READ_ONLY, bytes, null);
srcData.position((int) readOffset);
this.bindBuffer(GlBufferTarget.PIXEL_PACK_BUFFER, src);
this.bindBuffer(GlBufferTarget.PIXEL_UNPACK_BUFFER, dst);
GL15C.glUnmapBuffer(GL15C.GL_ARRAY_BUFFER);
ByteBuffer a = GL15.glMapBuffer(GlBufferTarget.PIXEL_PACK_BUFFER.getTargetParameter(), GL15.GL_READ_ONLY);
ByteBuffer b = GL15.glMapBuffer(GlBufferTarget.PIXEL_UNPACK_BUFFER.getTargetParameter(), GL15.GL_WRITE_ONLY);
this.bindBuffer(GlBufferTarget.ARRAY_BUFFER, dst);
ByteBuffer dstData = GL15C.glMapBuffer(GL15C.GL_ARRAY_BUFFER, GL15C.GL_WRITE_ONLY, null);
dstData.position((int) writeOffset);
LibCString.memcpy(
b.position(Math.toIntExact(writeOffset)).limit(Math.toIntExact(writeOffset + bytes)),
a.position(Math.toIntExact(readOffset)).limit(Math.toIntExact(readOffset + bytes))
);
ByteBuffer srcSlice = srcData.slice(0, (int) bytes);
dstData.put(srcSlice);
GL15C.glUnmapBuffer(GL15C.GL_ARRAY_BUFFER);
GL15.glUnmapBuffer(GlBufferTarget.PIXEL_PACK_BUFFER.getTargetParameter());
GL15.glUnmapBuffer(GlBufferTarget.PIXEL_UNPACK_BUFFER.getTargetParameter());
}
@Override