public void func_110370_a(int var1) {
   this.field_110388_e.func_109047_d(var1);
   this.field_110385_f.clear();
   this.field_110385_f.put(var1);
   this.field_110385_f.flip();
   GL11.glDeleteTextures(this.field_110385_f);
 }
Beispiel #2
0
  @Override
  public void draw(boolean flip) {
    try {
      if (ladder != null) GL11.glDeleteTextures(ladder.getTextureID());
      ladder =
          TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/amobox.png"));
    } catch (IOException e) {
      e.printStackTrace();
    }
    ladder.bind();
    GL11.glLoadIdentity();
    GL11.glTranslated(x, y, 0);

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(100, 100);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2f(100 + ladder.getTextureWidth(), 100);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2f(100 + ladder.getTextureWidth(), 100 + ladder.getTextureHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2f(100, 100 + ladder.getTextureHeight());
    GL11.glEnd();
    GL11.glLoadIdentity();
  }
Beispiel #3
0
 /** Deletes a single GL texture */
 public void deleteTexture(int par1) {
   this.textureNameToImageMap.removeObject(par1);
   this.singleIntBuffer.clear();
   this.singleIntBuffer.put(par1);
   this.singleIntBuffer.flip();
   GL11.glDeleteTextures(this.singleIntBuffer);
 }
Beispiel #4
0
  private static void setupShadowRenderTexture() {
    if (shadowPassInterval <= 0) {
      return;
    }

    // depth
    glDeleteTextures(sfbDepthTexture);
    sfbDepthTexture = glGenTextures();
    glBindTexture(GL_TEXTURE_2D, sfbDepthTexture);

    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    ByteBuffer buffer = ByteBuffer.allocateDirect(shadowMapWidth * shadowMapHeight * 4);
    glTexImage2D(
        GL_TEXTURE_2D,
        0,
        GL_DEPTH_COMPONENT,
        shadowMapWidth,
        shadowMapHeight,
        0,
        GL_DEPTH_COMPONENT,
        GL11.GL_FLOAT,
        buffer);
  }
 public void deleteImage(Image image) {
   int texId = image.getId();
   if (texId != -1) {
     ib1.put(0, texId);
     ib1.position(0).limit(1);
     glDeleteTextures(ib1);
     image.resetObject();
   }
 }
 void delete() {
   if (!deleted) {
     deleted = true;
     if (ownTexture) {
       GL11.glDeleteTextures(texture);
     }
     EXTFramebufferObject.glDeleteFramebuffersEXT(frameBuffer);
   }
 }
Beispiel #7
0
 public void cleanUP() {
   for (int vao : vaos) {
     GL30.glDeleteVertexArrays(vao);
   }
   for (int vbo : vbos) {
     GL15.glDeleteBuffers(vbo);
   }
   for (int texture : textures) {
     GL11.glDeleteTextures(texture);
   }
 }
Beispiel #8
0
  /**
   * Called in response to the opengl context going away, perhaps as a result of the display mode
   * changing
   */
  public static void recreateTextures() {
    IntBuffer texNames = BufferUtils.createIntBuffer(textures.size());
    for (GLTexture glt : textures) {
      texNames.put(glt.id);
    }
    texNames.flip();

    GL11.glDeleteTextures(texNames);

    for (GLTexture glt : textures) {
      glt.recreate();
    }
  }
Beispiel #9
0
  private void initGLObjects() {
    if (clTexture != NULL) {
      checkCLError(clReleaseMemObject(clTexture));
      glDeleteTextures(glTexture);
    }

    glTexture = glGenTextures();

    // Init textures
    glBindTexture(GL_TEXTURE_2D, glTexture);
    glTexImage2D(
        GL_TEXTURE_2D,
        0,
        GL_RGBA8UI,
        ww,
        wh,
        0,
        GL_RGBA_INTEGER,
        GL_UNSIGNED_BYTE,
        (ByteBuffer) null);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

    clTexture =
        clCreateFromGLTexture2D(
            clContext, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, glTexture, errcode_ret);
    checkCLError(errcode_ret);
    glBindTexture(GL_TEXTURE_2D, 0);

    glViewport(0, 0, fbw, fbh);

    glUniform2f(sizeUniform, ww, wh);

    FloatBuffer projectionMatrix = BufferUtils.createFloatBuffer(4 * 4);
    glOrtho(0.0f, ww, 0.0f, wh, 0.0f, 1.0f, projectionMatrix);
    glUniformMatrix4fv(projectionUniform, false, projectionMatrix);

    shouldInitBuffers = false;
  }
Beispiel #10
0
  private static void setupRenderTextures() {
    glDeleteTextures(dfbTextures);
    glGenTextures(dfbTextures);

    for (int i = 0; i < colorAttachments; ++i) {
      glBindTexture(GL_TEXTURE_2D, dfbTextures.get(i));
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
      if (i == 1) { // depth buffer
        ByteBuffer buffer = ByteBuffer.allocateDirect(renderWidth * renderHeight * 4 * 4);
        glTexImage2D(
            GL_TEXTURE_2D,
            0,
            GL_RGB32F_ARB,
            renderWidth,
            renderHeight,
            0,
            GL_RGBA,
            GL11.GL_FLOAT,
            buffer);
      } else {
        ByteBuffer buffer = ByteBuffer.allocateDirect(renderWidth * renderHeight * 4);
        glTexImage2D(
            GL_TEXTURE_2D,
            0,
            GL_RGBA,
            renderWidth,
            renderHeight,
            0,
            GL_RGBA,
            GL_UNSIGNED_BYTE,
            buffer);
      }
    }
  }
Beispiel #11
0
 public void glDeleteTextures(int n, IntBuffer textures) {
   GL11.glDeleteTextures(textures);
 }
Beispiel #12
0
 public void destroy() {
   IntBuffer scratch = BufferUtils.createIntBuffer(1);
   scratch.put(0, fontTextureID);
   GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
   GL11.glDeleteTextures(scratch);
 }
 public static void freeAllTextures() {
   int[] used = getUsedTextures();
   GL11.glDeleteTextures(IntBuffer.wrap(used));
 }
 public static void freeUnusedTextures() {
   int[] unused = getUnUsedTextures();
   System.out.println("Freeing gl#" + unused);
   GL11.glDeleteTextures(IntBuffer.wrap(unused));
 }
 @Override
 public void release() {
   GL11.glDeleteTextures(this.textureId);
 }