List of usage examples for org.lwjgl.opengl GL11 glGetTexLevelParameteri
@NativeType("void") public static int glGetTexLevelParameteri(@NativeType("GLenum") int target, @NativeType("GLint") int level, @NativeType("GLenum") int pname)
From source file:org.getspout.spout.config.MipMapUtils.java
License:Open Source License
public static void initalizeTexture(int textureId) { GL11.glBindTexture(3553, textureId); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR); int textureWidth = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); int tileWidth = textureWidth / 16; setMipmapLevels(textureId, (int) Math.round(Math.log((double) tileWidth) / Math.log(2D))); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, getMipmapLevels(textureId)); ContextCapabilities capabilities = GLContext.getCapabilities(); if (capabilities.OpenGL30) { MipMapUtils.mode = 1;//from www. ja v a 2 s. c o m } else if (capabilities.GL_EXT_framebuffer_object) { MipMapUtils.mode = 2; } else if (capabilities.OpenGL14) { MipMapUtils.mode = 3; GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL11.GL_TRUE); } }
From source file:org.spoutcraft.client.config.MipMapUtils.java
License:Open Source License
public static void initalizeTexture(int textureId) { SpoutClient.getHandle().renderEngine.bindTexture(textureId); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR); int textureWidth = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); int tileWidth = textureWidth / 16; setMipmapLevels(textureId, (int) Math.round(Math.log((double) tileWidth) / Math.log(2D))); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, getMipmapLevels(textureId)); ContextCapabilities capabilities = GLContext.getCapabilities(); if (capabilities.OpenGL30) { MipMapUtils.mode = 1;/*from w w w . j a v a 2 s . c o m*/ } else if (capabilities.GL_EXT_framebuffer_object) { MipMapUtils.mode = 2; } else if (capabilities.OpenGL14) { MipMapUtils.mode = 3; GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL11.GL_TRUE); } }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static int glGetTexLevelParameteri(int a, int b, int c) { return GL11.glGetTexLevelParameteri(a, b, c); }
From source file:vazkii.botania.client.core.handler.MiscellaneousIcons.java
License:Open Source License
@SubscribeEvent public void dumpAtlas(ArrowLooseEvent evt) { if (!evt.getEntityPlayer().worldObj.isRemote || !((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) || !evt.getEntityPlayer().isSneaking()) return;//from ww w . ja v a 2s .com Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); 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); Botania.LOGGER.debug("Dumped atlas %d wide by %d tall%n", width, height); int pixels = width * height; IntBuffer buffer = BufferUtils.createIntBuffer(pixels); int[] pixelValues = new int[pixels]; GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1); GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer); buffer.get(pixelValues); BufferedImage bufferedimage = new BufferedImage(width, height, 2); for (int k = 0; k < height; ++k) { for (int l = 0; l < width; ++l) { bufferedimage.setRGB(l, k, pixelValues[k * width + l]); } } File mcFolder = Minecraft.getMinecraft().mcDataDir; File result = new File(mcFolder, "atlas.png"); try { ImageIO.write(bufferedimage, "png", result); } catch (IOException e) { Botania.LOGGER.warn("Failed to dump debug atlas"); } }