List of usage examples for org.lwjgl.opengl GL15 glMapBuffer
@Nullable @NativeType("void *") public static ByteBuffer glMapBuffer(@NativeType("GLenum") int target, @NativeType("GLenum") int access)
From source file:ar.com.quark.backend.lwjgl.opengl.DesktopGLES20.java
License:Apache License
/** * {@inheritDoc}//from w ww . ja v a 2s.c o m */ @Override public <T extends Array<?>> T glMapBuffer(int target, int access, int format) { switch (format) { case GL_UNSIGNED_BYTE: return (T) new DesktopArrayFactory.DesktopUInt8Array(GL15.glMapBuffer(target, access)); case GL_UNSIGNED_SHORT: return (T) new DesktopArrayFactory.DesktopUInt16Array(GL15.glMapBuffer(target, access)); case GL_UNSIGNED_INT: return (T) new DesktopArrayFactory.DesktopUInt32Array(GL15.glMapBuffer(target, access)); case GL_BYTE: return (T) new DesktopArrayFactory.DesktopInt8Array(GL15.glMapBuffer(target, access)); case GL_SHORT: return (T) new DesktopArrayFactory.DesktopInt16Array(GL15.glMapBuffer(target, access)); case GL_INT: return (T) new DesktopArrayFactory.DesktopInt32Array(GL15.glMapBuffer(target, access)); case GL_HALF_FLOAT: return (T) new DesktopArrayFactory.DesktopFloat16Array(GL15.glMapBuffer(target, access)); case GL_FLOAT: return (T) new DesktopArrayFactory.DesktopFloat32Array(GL15.glMapBuffer(target, access)); } throw new IllegalArgumentException("Format unsupported"); }
From source file:go.graphics.swing.opengl.LWJGLDrawContext.java
License:Open Source License
@Override public GLBuffer startWriteGeometry(GeometryHandle geometry) throws IllegalBufferException { if (canUseVBOs) { bindArrayBuffer(geometry);/*from w w w . j av a 2s .c o m*/ ByteBuffer buffer = GL15.glMapBuffer(GL15.GL_ARRAY_BUFFER, GL15.GL_WRITE_ONLY) .order(ByteOrder.nativeOrder()); return new GLByteBufferWrapper(buffer); } else { return new GLByteBufferWrapper(getGeometryBuffer(geometry)); } }