Example usage for org.lwjgl.opengl GL11 glGetTexLevelParameteri

List of usage examples for org.lwjgl.opengl GL11 glGetTexLevelParameteri

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glGetTexLevelParameteri.

Prototype

@NativeType("void")
public static int glGetTexLevelParameteri(@NativeType("GLenum") int target, @NativeType("GLint") int level,
        @NativeType("GLenum") int pname) 

Source Link

Document

Places integer information about texture image parameter pname for level-of-detail level of the specified target into params .

Usage

From source file:cn.academy.ability.client.ui.CPBar.java

License:GNU General Public License

private void addVertex(double x, double y) {
    double width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH),
            height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
    Tessellator.instance.addVertexWithUV(x, y, -90, x / width, y / height);
}

From source file:cn.lambdalib.util.client.HudUtils.java

License:MIT License

public static void rect(double x, double y, double u, double v, double width, double height, double texWidth,
        double texHeight) {
    int twidth = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH),
            theight = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
    double f = 1.0 / twidth, f1 = 1.0 / theight;
    Tessellator t = Tessellator.instance;
    t.startDrawingQuads();//from ww w . j av  a 2  s .c  o m
    t.addVertexWithUV(x + 0, y + height, zLevel, (u + 0) * f, (v + texHeight) * f1);
    t.addVertexWithUV(x + width, y + height, zLevel, (u + texWidth) * f, (v + texHeight) * f1);
    t.addVertexWithUV(x + width, y + 0, zLevel, (u + texWidth) * f, (v + 0) * f1);
    t.addVertexWithUV(x + 0, y + 0, zLevel, (u + 0) * f, (v + 0) * f1);
    t.draw();
}

From source file:cn.liutils.util.HudUtils.java

License:Open Source License

public static void checkResolution() {
    int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH),
            height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);

    if (width != 0 && height != 0)
        setTextureResolution(width, height);
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLTexture.java

License:Open Source License

public int getSizeX() {
    use(0);
    return GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLTexture.java

License:Open Source License

public int getSizeY() {
    use(0);
    return GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLTextureArray.java

License:Open Source License

@Override
public int getSizeX() {
    use(0);
    return GL11.glGetTexLevelParameteri(GL30.GL_TEXTURE_2D_ARRAY, 0, GL11.GL_TEXTURE_WIDTH);
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLTextureArray.java

License:Open Source License

@Override
public int getSizeY() {
    use(0);
    return GL11.glGetTexLevelParameteri(GL30.GL_TEXTURE_2D_ARRAY, 0, GL11.GL_TEXTURE_HEIGHT);
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLTextureArray.java

License:Open Source License

public int getSizeZ() {
    use(0);
    return GL11.glGetTexLevelParameteri(GL12.GL_TEXTURE_3D, 0, GL12.GL_TEXTURE_DEPTH);
}

From source file:itemrender.client.rendering.FBOHelper.java

License:MIT License

public void saveToFile(File file) {
    // Bind framebuffer texture
    GlStateManager.bindTexture(textureID);

    GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
    GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);

    int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
    int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);

    IntBuffer texture = BufferUtils.createIntBuffer(width * height);
    GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, texture);

    int[] texture_array = new int[width * height];
    texture.get(texture_array);//from  w w w. ja va 2  s .com

    BufferedImage image = new BufferedImage(renderTextureSize, renderTextureSize, BufferedImage.TYPE_INT_ARGB);
    image.setRGB(0, 0, renderTextureSize, renderTextureSize, texture_array, 0, width);

    file.mkdirs();
    try {
        ImageIO.write(image, "png", file);
    } catch (Exception e) {
        // Do nothing
    }
}

From source file:itemrender.client.rendering.FBOHelper.java

License:MIT License

public String getBase64() {
    // Bind framebuffer texture
    GlStateManager.bindTexture(textureID);

    GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
    GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);

    int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
    int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);

    IntBuffer texture = BufferUtils.createIntBuffer(width * height);
    GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, texture);

    int[] texture_array = new int[width * height];
    texture.get(texture_array);// w  w  w.  jav a2s  . c  o m

    BufferedImage image = new BufferedImage(renderTextureSize, renderTextureSize, BufferedImage.TYPE_INT_ARGB);
    image.setRGB(0, 0, renderTextureSize, renderTextureSize, texture_array, 0, width);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
        ImageIO.write(image, "PNG", out);
    } catch (IOException e) {
        // Do nothing
    }

    return Base64.encodeBase64String(out.toByteArray());
}