本文整理汇总了Java中net.minecraft.client.renderer.texture.TextureUtil.processPixelValues方法的典型用法代码示例。如果您正苦于以下问题:Java TextureUtil.processPixelValues方法的具体用法?Java TextureUtil.processPixelValues怎么用?Java TextureUtil.processPixelValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.texture.TextureUtil
的用法示例。
在下文中一共展示了TextureUtil.processPixelValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getImageFromFrameBuffer
import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public BufferedImage getImageFromFrameBuffer(Framebuffer buffer, int width, int height) {
int k = buffer.framebufferTextureWidth * buffer.framebufferTextureHeight;
if (pixelBuffer == null || pixelBuffer.capacity() < k) {
pixelBuffer = BufferUtils.createIntBuffer(k);
pixelValues = new int[k];
}
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
pixelBuffer.clear();
GlStateManager.bindTexture(buffer.framebufferTexture);
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
pixelBuffer.get(pixelValues);
TextureUtil.processPixelValues(pixelValues, buffer.framebufferTextureWidth, buffer.framebufferTextureHeight);
BufferedImage bufferedimage = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
int l = buffer.framebufferTextureHeight - buffer.framebufferHeight;
bufferedimage.setRGB(0, 0, width, height, pixelValues, l*buffer.framebufferTextureWidth, buffer.framebufferTextureWidth);
return bufferedimage;
}
示例2: createScreenshot
import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
public static BufferedImage createScreenshot(int width, int height, Framebuffer framebufferIn)
{
if (OpenGlHelper.isFramebufferEnabled())
{
width = framebufferIn.framebufferTextureWidth;
height = framebufferIn.framebufferTextureHeight;
}
int i = width * height;
if (pixelBuffer == null || pixelBuffer.capacity() < i)
{
pixelBuffer = BufferUtils.createIntBuffer(i);
pixelValues = new int[i];
}
GlStateManager.glPixelStorei(3333, 1);
GlStateManager.glPixelStorei(3317, 1);
pixelBuffer.clear();
if (OpenGlHelper.isFramebufferEnabled())
{
GlStateManager.bindTexture(framebufferIn.framebufferTexture);
GlStateManager.glGetTexImage(3553, 0, 32993, 33639, pixelBuffer);
}
else
{
GlStateManager.glReadPixels(0, 0, width, height, 32993, 33639, pixelBuffer);
}
pixelBuffer.get(pixelValues);
TextureUtil.processPixelValues(pixelValues, width, height);
BufferedImage bufferedimage = new BufferedImage(width, height, 1);
bufferedimage.setRGB(0, 0, width, height, pixelValues, 0, width);
return bufferedimage;
}
示例3: screenshot
import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
private BufferedImage screenshot() {
Framebuffer fb = Minecraft.getMinecraft().getFramebuffer();
Dimension mcSize = GuiDraw.displayRes();
Dimension texSize = mcSize;
if (OpenGlHelper.isFramebufferEnabled())
texSize = new Dimension(fb.framebufferTextureWidth, fb.framebufferTextureHeight);
int k = texSize.width * texSize.height;
if (pixelBuffer == null || pixelBuffer.capacity() < k) {
pixelBuffer = BufferUtils.createIntBuffer(k);
pixelValues = new int[k];
}
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
pixelBuffer.clear();
if (OpenGlHelper.isFramebufferEnabled()) {
GlStateManager.bindTexture(fb.framebufferTexture);
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
} else {
GL11.glReadPixels(0, 0, texSize.width, texSize.height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
}
pixelBuffer.get(pixelValues);
TextureUtil.processPixelValues(pixelValues, texSize.width, texSize.height);
BufferedImage img = new BufferedImage(mcSize.width, mcSize.height, BufferedImage.TYPE_INT_ARGB);
if (OpenGlHelper.isFramebufferEnabled()) {
int yOff = texSize.height - mcSize.height;
for (int y = 0; y < mcSize.height; ++y)
for (int x = 0; x < mcSize.width; ++x)
img.setRGB(x, y, pixelValues[(y + yOff) * texSize.width + x]);
} else {
img.setRGB(0, 0, texSize.width, height, pixelValues, 0, texSize.width);
}
return img;
}
示例4: createScreenshot
import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
private BufferedImage createScreenshot(int width, int height, Framebuffer frameBuffer)
{
this.hasData = false;
pixelBuffer.get(pixelValues);
TextureUtil.processPixelValues(pixelValues, width, height);
BufferedImage bufferedImage;
if (OpenGlHelper.isFramebufferEnabled())
{
bufferedImage = new BufferedImage(frameBuffer.framebufferWidth, frameBuffer.framebufferHeight, 1);
int j = frameBuffer.framebufferTextureHeight - frameBuffer.framebufferHeight;
for (int k = j; k < frameBuffer.framebufferTextureHeight; ++k)
{
for (int l = 0; l < frameBuffer.framebufferWidth; ++l)
{
bufferedImage.setRGB(l, k - j, pixelValues[k * frameBuffer.framebufferTextureWidth + l]);
}
}
}
else
{
bufferedImage = new BufferedImage(width, height, 1);
bufferedImage.setRGB(0, 0, width, height, pixelValues, 0, width);
}
return bufferedImage;
}
示例5: screenshot
import net.minecraft.client.renderer.texture.TextureUtil; //导入方法依赖的package包/类
private BufferedImage screenshot() {
Framebuffer fb = Minecraft.getMinecraft().getFramebuffer();
Dimension mcSize = GuiDraw.getDisplayRes();
Dimension texSize = mcSize;
if (OpenGlHelper.isFramebufferEnabled()) {
texSize = new Dimension(fb.framebufferTextureWidth, fb.framebufferTextureHeight);
}
int k = texSize.width * texSize.height;
if (pixelBuffer == null || pixelBuffer.capacity() < k) {
pixelBuffer = BufferUtils.createIntBuffer(k);
pixelValues = new int[k];
}
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
pixelBuffer.clear();
if (OpenGlHelper.isFramebufferEnabled()) {
GlStateManager.bindTexture(fb.framebufferTexture);
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
} else {
GL11.glReadPixels(0, 0, texSize.width, texSize.height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
}
pixelBuffer.get(pixelValues);
TextureUtil.processPixelValues(pixelValues, texSize.width, texSize.height);
BufferedImage img = new BufferedImage(mcSize.width, mcSize.height, BufferedImage.TYPE_INT_ARGB);
if (OpenGlHelper.isFramebufferEnabled()) {
int yOff = texSize.height - mcSize.height;
for (int y = 0; y < mcSize.height; ++y) {
for (int x = 0; x < mcSize.width; ++x) {
img.setRGB(x, y, pixelValues[(y + yOff) * texSize.width + x]);
}
}
} else {
img.setRGB(0, 0, texSize.width, height, pixelValues, 0, texSize.width);
}
return img;
}