本文整理匯總了Java中org.lwjgl.opengl.GL12類的典型用法代碼示例。如果您正苦於以下問題:Java GL12類的具體用法?Java GL12怎麽用?Java GL12使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GL12類屬於org.lwjgl.opengl包,在下文中一共展示了GL12類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawButton
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
@Override
public void drawButton(Minecraft mc, int x, int y, float partialTicks) {
if (thisVisible) super.drawButton(mc, x, y, partialTicks);
if (visible) {
if (renderedStacks != null) {
int middleX = this.x + width / 2;
int startX = middleX - renderedStacks.length * 9 + 1;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
for (int i = 0; i < renderedStacks.length; i++) {
itemRenderer.renderItemAndEffectIntoGUI(renderedStacks[i], startX + i * 18, this.y + 2);
}
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
if (resLoc != null) {
mc.getTextureManager().bindTexture(resLoc);
drawModalRectWithCustomSizedTexture(this.x + width / 2 - 8, this.y + 2, 0, 0, 16, 16, 16, 16);
}
if (enabled && !thisVisible && x >= this.x && y >= this.y && x < this.x + width && y < this.y + height) {
Gui.drawRect(this.x, this.y, this.x + width, this.y + height, invisibleHoverColor);
}
}
}
示例2: allocateTextureImpl
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_)
{
deleteTexture(p_180600_0_);
bindTexture(p_180600_0_);
if (p_180600_1_ >= 0)
{
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)p_180600_1_);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
}
for (int i = 0; i <= p_180600_1_; ++i)
{
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i, GL11.GL_RGBA, p_180600_2_ >> i, p_180600_3_ >> i, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)((IntBuffer)null));
}
}
示例3: uploadTextureImageSubImpl
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
private static void uploadTextureImageSubImpl(BufferedImage p_110993_0_, int p_110993_1_, int p_110993_2_, boolean p_110993_3_, boolean p_110993_4_)
{
int i = p_110993_0_.getWidth();
int j = p_110993_0_.getHeight();
int k = 4194304 / i;
int[] aint = new int[k * i];
setTextureBlurred(p_110993_3_);
setTextureClamped(p_110993_4_);
for (int l = 0; l < i * j; l += i * k)
{
int i1 = l / i;
int j1 = Math.min(k, j - i1);
int k1 = i * j1;
p_110993_0_.getRGB(0, i1, i, j1, aint, 0, i);
copyToBuffer(aint, k1);
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, p_110993_1_, p_110993_2_ + i1, i, j1, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)dataBuffer);
}
}
示例4: uploadTextureSub
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
private static void uploadTextureSub(int p_147947_0_, int[] p_147947_1_, int p_147947_2_, int p_147947_3_, int p_147947_4_, int p_147947_5_, boolean p_147947_6_, boolean p_147947_7_, boolean p_147947_8_)
{
int i = 4194304 / p_147947_2_;
setTextureBlurMipmap(p_147947_6_, p_147947_8_);
setTextureClamped(p_147947_7_);
int j;
for (int k = 0; k < p_147947_2_ * p_147947_3_; k += p_147947_2_ * j)
{
int l = k / p_147947_2_;
j = Math.min(i, p_147947_3_ - l);
int i1 = p_147947_2_ * j;
copyToBufferPos(p_147947_1_, k, i1);
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, p_147947_0_, p_147947_4_, p_147947_5_ + l, p_147947_2_, j, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)dataBuffer);
}
}
示例5: loadCubeMap
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
public static int loadCubeMap(MyFile[] textureFiles) {
int texID = GL11.glGenTextures();
GL13.glActiveTexture(GL13.GL_TEXTURE0);
GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, texID);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
for (int i = 0; i < textureFiles.length; i++) {
TextureData data = decodeTextureFile(textureFiles[i]);
GL11.glTexImage2D(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL11.GL_RGBA, data.getWidth(),
data.getHeight(), 0, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE, data.getBuffer());
}
GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, 0);
return texID;
}
示例6: drawItemStack
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
/**
* Draws an ItemStack
*
* @param itemStack itemstack to draw
* @param x startX
* @param y startY
*/
public void drawItemStack(ItemStack itemStack, int x, int y) {
int[][] savedGLState = OpenGLHelper.saveGLState(new int[]{GL11.GL_ALPHA_TEST, GL11.GL_LIGHTING});
RenderItem renderItem = mc.getRenderItem();
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_DEPTH_TEST);
renderItem.renderItemIntoGUI(itemStack, x, y);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
OpenGLHelper.restoreGLState(savedGLState);
}
示例7: doSave
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
private static void doSave(ResourceLocation texture, String filename) {
mc.getTextureManager().bindTexture(texture);
RenderUtil.checkGLError("Before save 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);
//int format = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_INTERNAL_FORMAT);
int bufferSize = width * height;
RenderUtil.checkGLError("After get texture info");
IntBuffer pixelBuffer = BufferUtils.createIntBuffer(bufferSize);
int[] pixelValues = new int[bufferSize];
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, pixelBuffer);
pixelBuffer.get(pixelValues);
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
img.setRGB(0, 0, width, height, pixelValues, 0, width);
try {
ImageIO.write(img, "png", new File(filename));
} catch (IOException e) {
e.printStackTrace();
}
RenderUtil.checkGLError("After save texture");
}
示例8: doRender
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
@Override
public void doRender(Entity entity, double x, double y, double z, float f, float partialTickTime)
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
EntitySmallAsteroid asteroid = (EntitySmallAsteroid) entity;
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y + 0.5F, (float) z);
GL11.glRotatef(asteroid.rotationPitch, 1, 0, 0);
GL11.glRotatef(asteroid.rotationYaw, 0, 1, 0);
this.bindEntityTexture(asteroid);
this.blockRenderer.renderBlockAsItem(AsteroidBlocks.blockBasic, 0, 1.0F);
GL11.glPopMatrix();
}
示例9: doRender
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
@Override
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9)
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
final float var24 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9;
final float var25 = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9;
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(180.0F - var24, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-var25, 0.0F, 1.0F, 0.0F);
this.bindEntityTexture(entity);
GL11.glScalef(-1.0F, -1.0F, 1.0F);
GL11.glScalef(0.65F, 0.6F, 0.65F);
modelEntryPod.renderAll();
GL11.glPopMatrix();
}
示例10: renderGrappleGun
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
private void renderGrappleGun(ItemRenderType type, RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ)
{
if (type == ItemRenderType.INVENTORY)
{
GL11.glPushMatrix();
GL11.glScalef(0.7F, 0.75F, 0.5F);
GL11.glTranslatef(0.5F, -0.2F, -0.5F);
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderManager.instance.itemRenderer.renderItem(FMLClientHandler.instance().getClientPlayerEntity(), new ItemStack(Items.string, 1), 0, ItemRenderType.INVENTORY);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
GL11.glPushMatrix();
this.transform(type);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ItemRendererGrappleHook.grappleTexture);
ItemRendererGrappleHook.modelGrapple.renderAll();
GL11.glPopMatrix();
}
示例11: renderTileEntityAt
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
@Override
public void renderTileEntityAt(TileEntity var1, double par2, double par4, double par6, float var8)
{
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
GL11.glTranslatef(0.5F, 3.0F, 0.5F);
GL11.glScalef(1.3F, -1.3F, -1.3F);
this.bindTexture(TileEntityNasaWorkbenchRenderer.assemblyTableTexture);
this.model.renderAll();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
示例12: drawIcons
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
@Override
public void drawIcons()
{
int x = buttonX();
LayoutManager.drawIcon(x+4, 4, new Image(120, 24, 12, 12)); x+=24;
LayoutManager.drawIcon(x+4, 4, new Image(120, 12, 12, 12)); x+=24;
LayoutManager.drawIcon(x+4, 4, new Image(168, 24, 12, 12)); x+=24;
LayoutManager.drawIcon(x+4, 4, new Image(144, 12, 12, 12)); x+=24;
LayoutManager.drawIcon(x+4, 4, new Image(180, 24, 12, 12)); x+=24;
LayoutManager.drawIcon(x+4, 4, new Image(132, 12, 12, 12)); x+=24;
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
ItemStack sword = new ItemStack(Items.diamond_sword);
sword.addEnchantment(Enchantment.sharpness, 1);
GuiContainerManager.drawItem(x+2, 2, sword); x+=24;
GuiContainerManager.drawItem(x+2, 2, new ItemStack(Items.potionitem)); x+=24;
GuiContainerManager.drawItem(x+2, 2, new ItemStack(Blocks.stone)); x+=24;
}
示例13: renderEquippedItem
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
public static void renderEquippedItem(ItemRenderType type, IItemRenderer customRenderer, RenderBlocks renderBlocks, EntityLivingBase entity, ItemStack item)
{
if (customRenderer.shouldUseRenderHelper(type, item, EQUIPPED_BLOCK))
{
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
customRenderer.renderItem(type, item, renderBlocks, entity);
GL11.glPopMatrix();
}
else
{
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(0.0F, -0.3F, 0.0F);
GL11.glScalef(1.5F, 1.5F, 1.5F);
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
customRenderer.renderItem(type, item, renderBlocks, entity);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
示例14: drawPoint
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
public static void drawPoint(Vertice v1, float size)
{
GL11.glPushMatrix();
GL11.glTranslatef(v1.x, v1.y, v1.z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
size /= 2;
Tessellator t = Tessellator.instance;
GL11.glRotatef(180 - Minecraft.getMinecraft().thePlayer.rotationYaw, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(90 - Minecraft.getMinecraft().thePlayer.rotationPitch, 1.0F, 0.0F, 0.0F);
t.startDrawingQuads();
t.setNormal(0.0F, 1.0F, 0.0F);
t.addVertexWithUV(-size, 0, -size, 0, 0);
t.addVertexWithUV(size, 0, -size, 1, 0);
t.addVertexWithUV(size, 0, size, 1, 1);
t.addVertexWithUV(-size, 0, size, 0, 1);
t.draw();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
示例15: drawLine
import org.lwjgl.opengl.GL12; //導入依賴的package包/類
public static void drawLine(Vertice v1, float size1, Vertice v2, float size2)
{
GL11.glPushMatrix();
GL11.glTranslatef(v1.x, v1.y, v1.z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
size1 /= 2;
size2 /= 2;
Tessellator t = Tessellator.instance;
GL11.glRotatef(180 - Minecraft.getMinecraft().thePlayer.rotationYaw, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(90 - Minecraft.getMinecraft().thePlayer.rotationPitch, 1.0F, 0.0F, 0.0F);
t.startDrawingQuads();
t.setNormal(0.0F, 1.0F, 0.0F);
t.addVertexWithUV(-size1, 0, -size1, 0, 0);
t.addVertexWithUV(size1, 0, -size1, 1, 0);
t.addVertexWithUV(size1, 0, size1, 1, 1);
t.addVertexWithUV(-size1, 0, size1, 0, 1);
t.draw();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}