コード例 #1
0
  /**
   * Entry point to C language function: <code>
   *  GLint {@native gluBuild1DMipmapLevels}(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data)
   * </code> <br>
   * Part of <code>GLU_VERSION_1_X</code><br>
   *
   * @param data a direct or array-backed {@link java.nio.Buffer}
   */
  private int gluBuild1DMipmapLevelsC(
      int target,
      int internalFormat,
      int width,
      int format,
      int type,
      int level,
      int base,
      int max,
      Buffer data) {

    final boolean data_is_direct = Buffers.isDirect(data);
    final long __addr_ = getGLUProcAddressTable()._addressof_gluBuild1DMipmapLevels;
    if (__addr_ == 0) {
      throw new GLException(String.format("Method \"%s\" not available", "gluBuild1DMipmapLevels"));
    }
    return dispatch_gluBuild1DMipmapLevelsC1(
        target,
        internalFormat,
        width,
        format,
        type,
        level,
        base,
        max,
        data_is_direct ? data : Buffers.getArray(data),
        data_is_direct
            ? Buffers.getDirectBufferByteOffset(data)
            : Buffers.getIndirectBufferByteOffset(data),
        data_is_direct,
        __addr_);
  }
コード例 #2
0
 /** Optional, throws GLException if not available in profile */
 public final int gluScaleImage(
     int format,
     int widthin,
     int heightin,
     int typein,
     java.nio.Buffer datain,
     int widthout,
     int heightout,
     int typeout,
     java.nio.Buffer dataout) {
   validateMipmap();
   java.nio.ByteBuffer in = null;
   java.nio.ByteBuffer out = null;
   in = copyToByteBuffer(datain);
   if (dataout instanceof java.nio.ByteBuffer) {
     out = (java.nio.ByteBuffer) dataout;
   } else if (dataout instanceof java.nio.ShortBuffer) {
     out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_SHORT);
   } else if (dataout instanceof java.nio.IntBuffer) {
     out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_INT);
   } else if (dataout instanceof java.nio.FloatBuffer) {
     out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_FLOAT);
   } else {
     throw new IllegalArgumentException(
         "Unsupported destination buffer type (must be byte, short, int, or float)");
   }
   int errno =
       Mipmap.gluScaleImage(
           getCurrentGL2ES1(),
           format,
           widthin,
           heightin,
           typein,
           in,
           widthout,
           heightout,
           typeout,
           out);
   if (errno == 0) {
     out.rewind();
     if (out != dataout) {
       if (dataout instanceof java.nio.ShortBuffer) {
         ((java.nio.ShortBuffer) dataout).put(out.asShortBuffer());
       } else if (dataout instanceof java.nio.IntBuffer) {
         ((java.nio.IntBuffer) dataout).put(out.asIntBuffer());
       } else if (dataout instanceof java.nio.FloatBuffer) {
         ((java.nio.FloatBuffer) dataout).put(out.asFloatBuffer());
       } else {
         throw new RuntimeException("Should not reach here");
       }
     }
   }
   return (errno);
 }
コード例 #3
0
 private final ByteBuffer copyToByteBuffer(Buffer buf) {
   if (buf instanceof ByteBuffer) {
     if (buf.position() == 0) {
       return (ByteBuffer) buf;
     }
     return Buffers.copyByteBuffer((ByteBuffer) buf);
   } else if (buf instanceof ShortBuffer) {
     return Buffers.copyShortBufferAsByteBuffer((ShortBuffer) buf);
   } else if (buf instanceof IntBuffer) {
     return Buffers.copyIntBufferAsByteBuffer((IntBuffer) buf);
   } else if (buf instanceof FloatBuffer) {
     return Buffers.copyFloatBufferAsByteBuffer((FloatBuffer) buf);
   } else {
     throw new IllegalArgumentException(
         "Unsupported buffer type (must be one of byte, short, int, or float)");
   }
 }
コード例 #4
0
  /**
   * Entry point to C language function: <code>
   *  GLint {@native gluScaleImage}(GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *  dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid *  dataOut)
   * </code> <br>
   * Part of <code>GLU_VERSION_1_X</code><br>
   *
   * @param dataIn a direct or array-backed {@link java.nio.Buffer}
   * @param dataOut a direct or array-backed {@link java.nio.Buffer}
   */
  private int gluScaleImageC(
      int format,
      int wIn,
      int hIn,
      int typeIn,
      Buffer dataIn,
      int wOut,
      int hOut,
      int typeOut,
      Buffer dataOut) {

    final boolean dataIn_is_direct = Buffers.isDirect(dataIn);
    final boolean dataOut_is_direct = Buffers.isDirect(dataOut);
    final long __addr_ = getGLUProcAddressTable()._addressof_gluScaleImage;
    if (__addr_ == 0) {
      throw new GLException(String.format("Method \"%s\" not available", "gluScaleImage"));
    }
    return dispatch_gluScaleImageC1(
        format,
        wIn,
        hIn,
        typeIn,
        dataIn_is_direct ? dataIn : Buffers.getArray(dataIn),
        dataIn_is_direct
            ? Buffers.getDirectBufferByteOffset(dataIn)
            : Buffers.getIndirectBufferByteOffset(dataIn),
        dataIn_is_direct,
        wOut,
        hOut,
        typeOut,
        dataOut_is_direct ? dataOut : Buffers.getArray(dataOut),
        dataOut_is_direct
            ? Buffers.getDirectBufferByteOffset(dataOut)
            : Buffers.getIndirectBufferByteOffset(dataOut),
        dataOut_is_direct,
        __addr_);
  }