本文整理匯總了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;
}