コード例 #1
0
ファイル: Mipmap.java プロジェクト: rothwell/jogl
  public static int gluBuild1DMipmaps(
      GL gl, int target, int internalFormat, int width, int format, int type, ByteBuffer data) {
    int dataPos = data.position();

    try {
      int[] widthPowerOf2 = new int[1];
      int levels;
      int[] dummy = new int[1];

      int rc = checkMipmapArgs(internalFormat, format, type);
      if (rc != 0) {
        return (rc);
      }

      if (width < 1) {
        return (GLU.GLU_INVALID_VALUE);
      }

      closestFit(gl, target, width, 1, internalFormat, format, type, widthPowerOf2, dummy);
      levels = computeLog(widthPowerOf2[0]);

      return (BuildMipmap.gluBuild1DMipmapLevelsCore(
          gl, target, internalFormat, width, widthPowerOf2[0], format, type, 0, 0, levels, data));
    } finally {
      data.position(dataPos);
    }
  }
コード例 #2
0
ファイル: Mipmap.java プロジェクト: rothwell/jogl
  public static int gluBuild1DMipmapLevels(
      GL gl,
      int target,
      int internalFormat,
      int width,
      int format,
      int type,
      int userLevel,
      int baseLevel,
      int maxLevel,
      ByteBuffer data) {
    int dataPos = data.position();
    try {

      int levels;

      int rc = checkMipmapArgs(internalFormat, format, type);
      if (rc != 0) {
        return (rc);
      }

      if (width < 1) {
        return (GLU.GLU_INVALID_VALUE);
      }

      levels = computeLog(width);

      levels += userLevel;
      if (!isLegalLevels(userLevel, baseLevel, maxLevel, levels)) {
        return (GLU.GLU_INVALID_VALUE);
      }

      return (BuildMipmap.gluBuild1DMipmapLevelsCore(
          gl,
          target,
          internalFormat,
          width,
          width,
          format,
          type,
          userLevel,
          baseLevel,
          maxLevel,
          data));
    } finally {
      data.position(dataPos);
    }
  }