List of usage examples for org.lwjgl.opengl GL11 GL_TEXTURE_WIDTH
int GL_TEXTURE_WIDTH
To view the source code for org.lwjgl.opengl GL11 GL_TEXTURE_WIDTH.
Click Source Link
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();/* www . j a v a 2 s .co 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.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: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. j a va2 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);/*from w w w .jav a2s. co 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()); }
From source file:net.minecraftforge.client.CloudRenderer.java
License:Open Source License
private void reloadTextures() { if (mc.renderEngine != null) { mc.renderEngine.bindTexture(texture); texW = GlStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); texH = GlStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT); }//from w w w . j a va2s.c o m }
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 w w w . j av a 2 s. com } 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;/*w ww . 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); } }