mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-10 20:45:59 +01:00
Protect against java versioning
- Cast ByteBuffers to Buffer before calling #rewind or #flip
This commit is contained in:
parent
5d47cc6136
commit
07a2cfd7db
@ -5,6 +5,7 @@ import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.FileChannel;
|
||||
@ -182,7 +183,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener {
|
||||
try {
|
||||
bytebuffer = readToBuffer(is);
|
||||
int i = bytebuffer.position();
|
||||
bytebuffer.rewind();
|
||||
((Buffer) bytebuffer).rewind();
|
||||
return MemoryUtil.memASCII(bytebuffer, i);
|
||||
} catch (IOException e) {
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.jozufozu.flywheel.backend.gl.buffer;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@ -29,7 +30,7 @@ public class VecBuffer {
|
||||
}
|
||||
|
||||
public VecBuffer rewind() {
|
||||
internal.rewind();
|
||||
((Buffer) internal).rewind();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.jozufozu.flywheel.backend.instancing;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Arrays;
|
||||
@ -137,7 +138,7 @@ public class InstanceMaterial<D extends InstanceData> {
|
||||
vertices.putFloat(reader.getV(i));
|
||||
}
|
||||
|
||||
vertices.rewind();
|
||||
((Buffer) vertices).rewind();
|
||||
|
||||
// return new BufferedModel(GlPrimitive.QUADS, format, vertices, vertexCount);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.jozufozu.flywheel.core;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.EnumMap;
|
||||
@ -136,7 +137,7 @@ public class QuadConverter {
|
||||
type.castAndBuffer(indices, i + 2);
|
||||
type.castAndBuffer(indices, i + 3);
|
||||
}
|
||||
indices.flip();
|
||||
((Buffer) indices).flip();
|
||||
}
|
||||
|
||||
private GlBuffer getBuffer(GlNumericType type) {
|
||||
|
Loading…
Reference in New Issue
Block a user