Exemplo n.º 1
0
  @Override
  public void draw(final JCGLPrimitives p, final int first, final int count) throws JCGLException {
    NullCheck.notNull(p);
    RangeCheck.checkIncludedInInteger(first, "First", Ranges.NATURAL_INTEGER, "Valid index");
    RangeCheck.checkIncludedInInteger(count, "Count", Ranges.NATURAL_INTEGER, "Valid counts");

    this.g3.glDrawArrays(JOGLTypeConversions.primitiveToGL(p), first, count);
  }
Exemplo n.º 2
0
  @Override
  public void drawElementsInstanced(final JCGLPrimitives p, final int instances)
      throws JCGLException, JCGLExceptionBufferNotBound {
    NullCheck.notNull(p);
    RangeCheck.checkIncludedInInteger(
        instances, "Instances", Ranges.NATURAL_INTEGER, "Valid instances");

    if (this.index_buffers.indexBufferIsBound()) {
      final JOGLIndexBuffer ib = this.array_objects.getCurrentIndexBuffer();
      final int pgl = JOGLTypeConversions.primitiveToGL(p);
      final int type = JOGLTypeConversions.unsignedTypeToGL(ib.getType());
      this.g3.glDrawElementsInstanced(pgl, (int) ib.getIndices(), type, 0L, instances);
    } else {
      throw new JCGLExceptionBufferNotBound("No index buffer is currently bound");
    }
  }