@Override public JCGLArrayBufferType arrayBufferAllocate( final long size, final JCGLUsageHint usage) throws JCGLException { RangeCheck.checkIncludedInLong( size, "Size", Ranges.NATURAL_LONG, "Valid size range"); FakeArrayBuffers.LOG.debug( "allocate ({} bytes, {})", Long.valueOf(size), usage); final ByteBuffer data = ByteBuffer.allocate((int) size); final FakeArrayBuffer ao = new FakeArrayBuffer( this.context, this.context.getFreshID(), data, usage); this.actualBind(ao); return ao; }
@Override public JCGLArrayBufferType arrayBufferAllocate( final long size, final JCGLUsageHint usage) throws JCGLException { RangeCheck.checkIncludedInLong( size, "Size", Ranges.NATURAL_LONG, "Valid size range"); LOG.debug( "allocate ({} bytes, {})", Long.valueOf(size), usage); final ByteBuffer data = ByteBuffer.allocate((int) size); final FakeArrayBuffer ao = new FakeArrayBuffer( this.context, this.context.getFreshID(), data, usage); this.actualBind(ao); return ao; }
@Override public JCGLArrayBufferType arrayBufferAllocate( final long size, final JCGLUsageHint usage) throws JCGLException { NullCheck.notNull(usage, "Usage"); RangeCheck.checkIncludedInLong( size, "Size", Ranges.NATURAL_LONG, "Valid size range"); if (LOG.isDebugEnabled()) { LOG.debug( "allocate ({} bytes, {})", Long.valueOf(size), usage); } final int id = GL15.glGenBuffers(); if (LOG.isDebugEnabled()) { LOG.debug("allocated {}", Integer.valueOf(id)); } final LWJGL3ArrayBuffer a = new LWJGL3ArrayBuffer(this.context, id, size, usage); this.actualBind(a); GL15.glBufferData( GL15.GL_ARRAY_BUFFER, size, LWJGL3TypeConversions.usageHintToGL(usage)); return a; }
@Override public JCGLArrayBufferType arrayBufferAllocate( final long size, final JCGLUsageHint usage) throws JCGLException { NullCheck.notNull(usage); RangeCheck.checkIncludedInLong( size, "Size", Ranges.NATURAL_LONG, "Valid size range"); if (LWJGL3ArrayBuffers.LOG.isDebugEnabled()) { LWJGL3ArrayBuffers.LOG.debug( "allocate ({} bytes, {})", Long.valueOf(size), usage); } final int id = GL15.glGenBuffers(); if (LWJGL3ArrayBuffers.LOG.isDebugEnabled()) { LWJGL3ArrayBuffers.LOG.debug("allocated {}", Integer.valueOf(id)); } final LWJGL3ArrayBuffer a = new LWJGL3ArrayBuffer(this.context, id, size, usage); this.actualBind(a); GL15.glBufferData( GL15.GL_ARRAY_BUFFER, size, LWJGL3TypeConversions.usageHintToGL(usage)); return a; }
@Override public JCGLIndexBufferType indexBufferAllocate( final long indices, final JCGLUnsignedType type, final JCGLUsageHint usage) { NullCheck.notNull(usage, "Usage"); NullCheck.notNull(type, "Type"); RangeCheck.checkIncludedInLong( indices, "Index count", Ranges.NATURAL_LONG, "Valid index counts"); final long size = indices * (long) type.getSizeBytes(); LOG.debug( "allocate {} {} ({} bytes, {})", Long.toUnsignedString(size), type, Long.valueOf(size), usage); final int id = this.context.getFreshID(); final ByteBuffer data = ByteBuffer.allocate((int) size); LOG.debug("allocated {}", Integer.valueOf(id)); final FakeIndexBuffer ib = new FakeIndexBuffer(this.context, id, indices, type, data, usage); this.actualBind(ib); return ib; }
@Override public JCGLIndexBufferType indexBufferAllocate( final long indices, final JCGLUnsignedType type, final JCGLUsageHint usage) { NullCheck.notNull(usage); NullCheck.notNull(type); RangeCheck.checkIncludedInLong( indices, "Index count", Ranges.NATURAL_LONG, "Valid index counts"); final long size = indices * (long) type.getSizeBytes(); FakeIndexBuffers.LOG.debug( "allocate {} {} ({} bytes, {})", Long.toUnsignedString(size), type, Long.valueOf(size), usage); final int id = this.context.getFreshID(); final ByteBuffer data = ByteBuffer.allocate((int) size); FakeIndexBuffers.LOG.debug("allocated {}", Integer.valueOf(id)); final FakeIndexBuffer ib = new FakeIndexBuffer(this.context, id, indices, type, data, usage); this.actualBind(ib); return ib; }
RangeCheck.checkIncludedInLong( indices, "Index count", Ranges.NATURAL_LONG, "Valid index counts");
RangeCheck.checkIncludedInLong( indices, "Index count", Ranges.NATURAL_LONG, "Valid index counts");