@Override public void indexBufferReallocate( final JCGLIndexBufferUsableType i) throws JCGLException, JCGLExceptionDeleted, JCGLExceptionBufferNotBound { this.checkIndexBuffer(i); final JCGLArrayObjectUsableType ao = this.array_objects.arrayObjectGetCurrentlyBound(); final Optional<JCGLIndexBufferUsableType> i_opt = ao.getIndexBufferBound(); if (i_opt.isPresent()) { final JCGLIndexBufferUsableType current_ib = i_opt.get(); if (i.equals(current_ib)) { if (LWJGL3IndexBuffers.LOG.isTraceEnabled()) { final int id = current_ib.getGLName(); LWJGL3IndexBuffers.LOG.trace("reallocated {}", Integer.valueOf(id)); } final UnsignedRangeInclusiveL r = i.getRange(); final long size = r.getInterval(); final int usage = LWJGL3TypeConversions.usageHintToGL(i.getUsageHint()); GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, size, usage); return; } } throw LWJGL3IndexBuffers.notBound(i, i_opt); }
@Override public void indexBufferReallocate(final JCGLIndexBufferUsableType i) throws JCGLException, JCGLExceptionDeleted, JCGLExceptionBufferNotBound { this.checkIndexBuffer(i); final JCGLArrayObjectUsableType ao = this.array_objects.arrayObjectGetCurrentlyBound(); final Optional<JCGLIndexBufferUsableType> i_opt = ao.getIndexBufferBound(); if (i_opt.isPresent()) { final JCGLIndexBufferUsableType current_ib = i_opt.get(); if (i.equals(current_ib)) { final FakeIndexBuffer fa = (FakeIndexBuffer) i; final ByteBuffer fa_data = fa.getData(); /** * XXX: Clearly overflowing integers. */ final UnsignedRangeInclusiveL r = i.getRange(); final long lo = r.getLower(); final long hi = r.getUpper(); for (long index = lo; Long.compareUnsigned(index, hi) <= 0; ++index) { final int i_index = (int) index; fa_data.put(i_index, (byte) 0); } return; } } throw FakeIndexBuffers.notBound(i, i_opt); }
@Override public ByteBuffer indexBufferRead( final JCGLIndexBufferUsableType i, final JCGLByteBufferProducerType f) throws JCGLException, JCGLExceptionDeleted, JCGLExceptionBufferNotBound { NullCheck.notNull(i); this.checkIndexBuffer(i); final JCGLArrayObjectUsableType ao = this.array_objects.arrayObjectGetCurrentlyBound(); final Optional<JCGLIndexBufferUsableType> i_opt = ao.getIndexBufferBound(); if (i_opt.isPresent()) { final JCGLIndexBufferUsableType current_ib = i_opt.get(); if (i.equals(current_ib)) { final long size = i.getRange().getInterval(); final ByteBuffer b = f.apply(size); GL15.glGetBufferSubData(GL15.GL_ELEMENT_ARRAY_BUFFER, 0L, b); return b; } } throw LWJGL3IndexBuffers.notBound(i, i_opt); }
final JCGLIndexBufferUsableType current_ib = i_opt.get(); if (i.equals(current_ib)) { final UnsignedRangeInclusiveL r = i.getRange(); final long size = r.getInterval(); final ByteBuffer b = f.apply(size);