本文整理汇总了Java中org.lwjgl.opengl.GL11.glTranslatef方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glTranslatef方法的具体用法?Java GL11.glTranslatef怎么用?Java GL11.glTranslatef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glTranslatef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void doRender(EntityProjectileBase entity, double x, double y, double z, float yaw, float partialTick) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y + entity.height / 2, (float) z);
GL11.glColor4f(0.7F, 0.7F, 0.7F, 1F);
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTick - 90.0F,
0.0F, 1.0F, 0.0F);
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTick, 0.0F,
0.0F, 1.0F);
bindEntityTexture(entity);
if (entity.getCritical() == 2) {
GlStateManager.disableLighting();
model.render(entity, 0F, 0F, 0.0F, 0.0F, 0.0F, 0.0625F);
GlStateManager.enableLighting();
} else
model.render(entity, 0F, 0F, 0.0F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
示例2: enableLighting
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void enableLighting() {
GL11.glDisable((int)3042);
GL11.glEnable((int)3553);
GL11.glDisable((int)2848);
GL11.glDisable((int)3042);
OpenGlHelper.setActiveTexture((int)OpenGlHelper.lightmapTexUnit);
GL11.glMatrixMode((int)5890);
GL11.glLoadIdentity();
float var3 = 0.0039063f;
GL11.glScalef((float)var3, (float)var3, (float)var3);
GL11.glTranslatef((float)8.0f, (float)8.0f, (float)8.0f);
GL11.glMatrixMode((int)5888);
GL11.glTexParameteri((int)3553, (int)10241, (int)9729);
GL11.glTexParameteri((int)3553, (int)10240, (int)9729);
GL11.glTexParameteri((int)3553, (int)10242, (int)10496);
GL11.glTexParameteri((int)3553, (int)10243, (int)10496);
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
OpenGlHelper.setActiveTexture((int)OpenGlHelper.defaultTexUnit);
}
示例3: renderInventoryBlock
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void renderInventoryBlock(RenderBlocks renderblocks, Block block, IIcon icon) {
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
示例4: enterOrtho
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.opengl.renderer.SGL#enterOrtho(int, int)
*/
public void enterOrtho(int xsize, int ysize) {
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, width, height, 0, 1, -1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glTranslatef((width-xsize)/2,
(height-ysize)/2,0);
}
示例5: renderVortex
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void renderVortex(EntityVortex entity, double x, double y, double z, float var1, float partialTicks) {
int circlePoints = 200;
double radius = 0.5D;
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor4d(0.8, 0.8, 0.8D, 0.7D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks, 0.0F, 1.0F, 0.0F);
for (int i = 0; i < circlePoints; i++) {
float angleRadians = (float) i / (float) circlePoints * 2F * (float) Math.PI;
GL11.glPushMatrix();
GL11.glTranslated(radius * Math.sin(angleRadians), radius * Math.cos(angleRadians), 0);
renderGust();
GL11.glPopMatrix();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
}
示例6: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void render(Entity entity, float time, float distance, float loop, float lookY, float lookX, float scale) {
super.render(entity, time, distance, loop, lookY, lookX, scale);
setRotationAngles(time, distance, loop, lookY, lookX, scale, entity);
GL11.glPushMatrix();
GL11.glRotatef(initRotFix, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, offsetFixY, 0.0F);
GL11.glScalef(modelScaleX, modelScaleY, modelScaleZ);
for (Part p : this.parts) {
if (p instanceof PartObj) {
PartObj part = (PartObj) p;
if (!part.hasParent())
part.render(entity);
}
// TODO entity movement via PartEntityPos
// else if(p instanceof PartEntityPos)
// ((PartEntityPos) p).move(entity);
}
for (Bend bend : bends) {
bend.render(entity);
}
GL11.glPopMatrix();
}
示例7: renderWithRotation
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void renderWithRotation(float scale)
{
if (!this.isHidden)
{
if (this.showModel)
{
if (!this.compiled)
{
this.compileDisplayList(scale);
}
GL11.glPushMatrix();
GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale);
if (this.rotateAngleY != 0.0F)
{
GL11.glRotatef(this.rotateAngleY * 57.29578F, 0.0F, 1.0F, 0.0F);
}
if (this.rotateAngleX != 0.0F)
{
GL11.glRotatef(this.rotateAngleX * 57.29578F, 1.0F, 0.0F, 0.0F);
}
if (this.rotateAngleZ != 0.0F)
{
GL11.glRotatef(this.rotateAngleZ * 57.29578F, 0.0F, 0.0F, 1.0F);
}
GL11.glCallList(this.displayList);
GL11.glPopMatrix();
}
}
}
示例8: renderWithRotation
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void renderWithRotation(float f)
{
if(field_1402_i)
{
return;
}
if(!showModel)
{
return;
}
if(!compiled)
{
compileDisplayList(f);
}
GL11.glPushMatrix();
GL11.glTranslatef(rotationPointX * f, rotationPointY * f, rotationPointZ * f);
if(rotateAngleY != 0.0F)
{
GL11.glRotatef(rotateAngleY * 57.29578F, 0.0F, 1.0F, 0.0F);
}
if(rotateAngleX != 0.0F)
{
GL11.glRotatef(rotateAngleX * 57.29578F, 1.0F, 0.0F, 0.0F);
}
if(rotateAngleZ != 0.0F)
{
GL11.glRotatef(rotateAngleZ * 57.29578F, 0.0F, 0.0F, 1.0F);
}
GL11.glCallList(displayList);
GL11.glPopMatrix();
}
示例9: postRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void postRender(float f)
{
if(field_1402_i)
{
return;
}
if(!showModel)
{
return;
}
if(!compiled)
{
compileDisplayList(f);
}
if(rotateAngleX != 0.0F || rotateAngleY != 0.0F || rotateAngleZ != 0.0F)
{
GL11.glTranslatef(rotationPointX * f, rotationPointY * f, rotationPointZ * f);
if(rotateAngleZ != 0.0F)
{
GL11.glRotatef(rotateAngleZ * 57.29578F, 0.0F, 0.0F, 1.0F);
}
if(rotateAngleY != 0.0F)
{
GL11.glRotatef(rotateAngleY * 57.29578F, 0.0F, 1.0F, 0.0F);
}
if(rotateAngleX != 0.0F)
{
GL11.glRotatef(rotateAngleX * 57.29578F, 1.0F, 0.0F, 0.0F);
}
} else
if(rotationPointX != 0.0F || rotationPointY != 0.0F || rotationPointZ != 0.0F)
{
GL11.glTranslatef(rotationPointX * f, rotationPointY * f, rotationPointZ * f);
}
}
示例10: renderTileEntityAt
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void renderTileEntityAt(TileEntityTrack tileTrack, double x, double y, double z, float partialTicks, int destroyStage) {
super.renderTileEntityAt(tileTrack, x, y, z, partialTicks, destroyStage);
/*
* If there's nothing to render, don't render.
*/
if (tileTrack.curve == null) {
return;
}
/*
* Sometimes the TE's don't break evenly. Make sure this doesn't happen and we try to render a flag here.
*/
TileEntity tile = tileTrack.getWorld().getTileEntity(tileTrack.getPos().add(tileTrack.curve.endPos));
if( !(tile instanceof TileEntityTrack) ) {
return;
}
TileEntityTrack otherEnd = (TileEntityTrack) tile;
/* Quick check to see if connection is still valid. */
if (tileTrack.connectedTrack != null && tileTrack.connectedTrack.isInvalid()) {
// Reset the other track as well, if existent.
if (tileTrack.connectedTrack.connectedTrack == tileTrack) {
tileTrack.connectedTrack.connectedTrack = null;
tileTrack.connectedTrack.hasTriedToConnectToOtherSegment = false;
}
// Then reset this track.
tileTrack.connectedTrack = null;
tileTrack.hasTriedToConnectToOtherSegment = false;
}
/* If this Tile Entity is not connected, and has not tried to connect, do so now. */
if (!tileTrack.hasTriedToConnectToOtherSegment) {
tileTrack.hasTriedToConnectToOtherSegment = connectToAdjacentTracks(tileTrack);
}
/*
* Try to keep the same track rendering if possible. If the track isn't null, render that one instead.
*/
if (isTrackPrimary(otherEnd, tileTrack)) {
this.renderTileEntityAt(otherEnd, x + otherEnd.getPos().getX() - tileTrack.getPos().getX(), y + otherEnd.getPos().getY() - tileTrack.getPos().getY(), z + otherEnd.getPos().getZ() - tileTrack.getPos().getZ(), partialTicks, destroyStage);
return;
}
/*
* Otherwise render this track.
*/
GL11.glPushMatrix();
{
/* Translate render position. */
GL11.glTranslated(x, y, z);
/* Render the finished track, including track beds and rails. */
GL11.glPushMatrix();
{
renderTrackFromCurve(tileTrack, tileTrack.connectedTrack, otherEnd.connectedTrack);
}
GL11.glPopMatrix();
/* Render ballast at start and end (block) position of track, respectively. */
Minecraft.getMinecraft().getTextureManager().bindTexture(ballastTexture);
GL11.glPushMatrix();
{
int lightValue = tileTrack.getWorld().getCombinedLight(tileTrack.getPos(), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightValue%65536, lightValue/65536);
drawBallastBox();
GL11.glTranslatef(tileTrack.curve.endPos.getX(), tileTrack.curve.endPos.getY(), tileTrack.curve.endPos.getZ());
lightValue = tileTrack.getWorld().getCombinedLight(tileTrack.getPos().add(tileTrack.curve.endPos), 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightValue%65536, lightValue/65536);
drawBallastBox();
}
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
示例11: translate
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void translate(float x, float y, float z)
{
GL11.glTranslatef(x, y, z);
}
示例12: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void render(float alpha)
{
setScrollPos(scrollPos);
float x0 = pos.x - radius.x, x1 = pos.x + radius.x;
float y0 = pos.y - radius.y, y1 = pos.y + radius.y;
GL11.glLineWidth(1.0f);
GL11.glColor4f(1.0f, 1.0f, 1.0f, alpha);
GL11.glBegin(GL11.GL_LINE_LOOP);
GL11.glVertex2f(x0, y0);
GL11.glVertex2f(x0, y1);
GL11.glVertex2f(x1, y1);
GL11.glVertex2f(x1, y0);
GL11.glEnd();
float barX = x1 - BAR_WIDTH;
GL11.glColor4f(1.0f, 1.0f, 1.0f, alpha*0.25f);
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex2f(barX, y0);
GL11.glVertex2f(barX, y1);
GL11.glEnd();
upButton.render(alpha);
downButton.render(alpha);
thumb.render(alpha);
if (content != null)
{
//Enable stencil writing, disable color writing.
GL11.glEnable(GL11.GL_STENCIL_TEST);
GL11.glColorMask(false, false, false, false);
GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 0xFF);
GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE);
//Draw stencil mask.
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(x0, y0);
GL11.glVertex2f(x0, y1);
GL11.glVertex2f(barX, y1);
GL11.glVertex2f(barX, y0);
GL11.glEnd();
//Disable stencil writing, enable color writing.
GL11.glColorMask(true, true, true, true);
GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF);
GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP);
GL11.glPushMatrix();
GL11.glTranslatef(0.0f, scrollPos, 0.0f);
content.render(alpha);
GL11.glPopMatrix();
//Disable stencil.
GL11.glDisable(GL11.GL_STENCIL_TEST);
//Clear stencil buffer.
GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT);
}
}
示例13: renderStoredItems
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void renderStoredItems(Entity_AA turret)
{
int slot = 0;
float modX = 0;
float modY = 0;
int iconsPerRow = 4;
int iconMulti = 1;
int iconsDrawn = 0;
while (slot < turret.storage.length)
{
ItemStack itemstack = turret.storage[slot];
//System.out.println("[RENDER] Itemstack in slot " + slot + " is " + itemstack);
if (itemstack != null && itemstack.getItem() != null)
{
GL11.glPushMatrix();
GL11.glTranslatef(0.32F, 0.35F + modY, -0.35F + modX);
modX += 0.15f; // One step back
float scale = 0.08F; // Smaller, to make that less blatant
GL11.glScalef(scale, -scale, scale);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
int color = itemstack.getItem().getColorFromItemStack(itemstack, 0);
float f4 = (float)(color >> 16 & 255) / 255.0F;
float f5 = (float)(color >> 8 & 255) / 255.0F;
float f2 = (float)(color & 255) / 255.0F;
GL11.glColor4f(f4, f5, f2, 1.0F);
this.renderManager.itemRenderer.renderItem(turret, itemstack, 0);
GL11.glPopMatrix();
iconsDrawn += 1;
}
if (iconsDrawn == (iconsPerRow * iconMulti)) // This many items are shown per row
{
modX = 0; // Reset
modY = 0.15f; // One row down
iconMulti += 1;
}
slot += 1;
}
}
示例14: renderEntityOnFire
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void renderEntityOnFire(Entity entity, double d, double d1, double d2,
float f)
{
GL11.glDisable(2896 /*GL_LIGHTING*/);
int i = Block.fire.blockIndexInTexture;
int j = (i & 0xf) << 4;
int k = i & 0xf0;
float f1 = (float)j / 256F;
float f3 = ((float)j + 15.99F) / 256F;
float f5 = (float)k / 256F;
float f7 = ((float)k + 15.99F) / 256F;
GL11.glPushMatrix();
GL11.glTranslatef((float)d, (float)d1, (float)d2);
float f9 = entity.width * 1.4F;
GL11.glScalef(f9, f9, f9);
loadTexture("/terrain.png");
Tessellator tessellator = Tessellator.instance;
float f10 = 0.5F;
float f11 = 0.0F;
float f12 = entity.height / f9;
float f13 = (float)(entity.posY - entity.boundingBox.minY);
GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.0F, -0.3F + (float)(int)f12 * 0.02F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f14 = 0.0F;
int l = 0;
tessellator.startDrawingQuads();
while(f12 > 0.0F)
{
float f2;
float f4;
float f6;
float f8;
if(l % 2 == 0)
{
f2 = (float)j / 256F;
f4 = ((float)j + 15.99F) / 256F;
f6 = (float)k / 256F;
f8 = ((float)k + 15.99F) / 256F;
} else
{
f2 = (float)j / 256F;
f4 = ((float)j + 15.99F) / 256F;
f6 = (float)(k + 16) / 256F;
f8 = ((float)(k + 16) + 15.99F) / 256F;
}
if((l / 2) % 2 == 0)
{
float f15 = f4;
f4 = f2;
f2 = f15;
}
tessellator.addVertexWithUV(f10 - f11, 0.0F - f13, f14, f4, f8);
tessellator.addVertexWithUV(-f10 - f11, 0.0F - f13, f14, f2, f8);
tessellator.addVertexWithUV(-f10 - f11, 1.4F - f13, f14, f2, f6);
tessellator.addVertexWithUV(f10 - f11, 1.4F - f13, f14, f4, f6);
f12 -= 0.45F;
f13 -= 0.45F;
f10 *= 0.9F;
f14 += 0.03F;
l++;
}
tessellator.draw();
GL11.glPopMatrix();
GL11.glEnable(2896 /*GL_LIGHTING*/);
}
示例15: doRender_PredictiveArrow
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void doRender_PredictiveArrow(Entity par1EntityArrow, double par2, double par4, double par6, float par8, float par9)
{
this.bindEntityTexture(par1EntityArrow);
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.instance;
byte b0 = 0;
float f2 = 0.0F;
float f3 = 0.5F;
float f4 = (float)(0 + b0 * 10) / 32.0F;
float f5 = (float)(5 + b0 * 10) / 32.0F;
float f6 = 0.0F;
float f7 = 0.15625F;
float f8 = (float)(5 + b0 * 10) / 32.0F;
float f9 = (float)(10 + b0 * 10) / 32.0F;
float f10 = 0.05625F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
GL11.glScalef(f10, f10, f10);
GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
GL11.glNormal3f(f10, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8);
tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8);
tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9);
tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9);
tessellator.draw();
GL11.glNormal3f(-f10, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8);
tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8);
tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9);
tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9);
tessellator.draw();
for (int i = 0; i < 4; ++i)
{
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4);
tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4);
tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5);
tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5);
tessellator.draw();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}