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.embeddedt.embeddium.impl.gl.util.VAOUtil;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.lwjgl.opengl.*; import org.lwjgl.opengl.*;
import org.lwjgl.system.libc.LibCString;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
public class GLRenderDevice implements RenderDevice { public class GLRenderDevice implements RenderDevice {
@@ -116,20 +118,19 @@ public class GLRenderDevice implements RenderDevice {
return; return;
} }
this.bindBuffer(GlBufferTarget.ARRAY_BUFFER, src); this.bindBuffer(GlBufferTarget.PIXEL_PACK_BUFFER, src);
ByteBuffer srcData = GL15C.glMapBuffer(GL15C.GL_ARRAY_BUFFER, GL15C.GL_READ_ONLY, bytes, null); this.bindBuffer(GlBufferTarget.PIXEL_UNPACK_BUFFER, dst);
srcData.position((int) readOffset);
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); LibCString.memcpy(
ByteBuffer dstData = GL15C.glMapBuffer(GL15C.GL_ARRAY_BUFFER, GL15C.GL_WRITE_ONLY, null); b.position(Math.toIntExact(writeOffset)).limit(Math.toIntExact(writeOffset + bytes)),
dstData.position((int) writeOffset); a.position(Math.toIntExact(readOffset)).limit(Math.toIntExact(readOffset + bytes))
);
ByteBuffer srcSlice = srcData.slice(0, (int) bytes); GL15.glUnmapBuffer(GlBufferTarget.PIXEL_PACK_BUFFER.getTargetParameter());
dstData.put(srcSlice); GL15.glUnmapBuffer(GlBufferTarget.PIXEL_UNPACK_BUFFER.getTargetParameter());
GL15C.glUnmapBuffer(GL15C.GL_ARRAY_BUFFER);
} }
@Override @Override