本文整理汇总了Java中org.lwjgl.opengl.GL11.glTranslated方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glTranslated方法的具体用法?Java GL11.glTranslated怎么用?Java GL11.glTranslated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glTranslated方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void render(double x, double y, double z, double gunRadius) {
if (isMinigunActivated() && getMinigunSpeed() == MAX_GUN_SPEED && gunAimedAtTarget && attackTarget != null) {
GL11.glPushMatrix();
GL11.glScaled(1, 1, 1);
GL11.glTranslated(-x, -y, -z);
GL11.glDisable(GL11.GL_TEXTURE_2D);
//GL11.glDisable(GL11.GL_LIGHTING);
RenderUtils.glColorHex(0xFF000000 | getAmmoColor());
for (int i = 0; i < 5; i++) {
Vec3d vec = new Vec3d(attackTarget.posX - x, attackTarget.posY - y, attackTarget.posZ - z).normalize();
minigunFire.startX = x + vec.x * gunRadius;
minigunFire.startY = y + vec.y * gunRadius;
minigunFire.startZ = z + vec.z * gunRadius;
minigunFire.endX = attackTarget.posX + rand.nextDouble() - 0.5;
minigunFire.endY = attackTarget.posY + attackTarget.height / 2 + rand.nextDouble() - 0.5;
minigunFire.endZ = attackTarget.posZ + rand.nextDouble() - 0.5;
minigunFire.render();
}
GL11.glColor4d(1, 1, 1, 1);
// GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
}
}
示例2: renderModel
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void renderModel(float size, float[] angles) {
GL11.glPushMatrix();
GL11.glRotatef(angles[0], 0, 1, 0);
baseTurn.render(size);
baseTurn2.render(size);
GL11.glTranslated(0, 18 / 16F, 0);
GL11.glRotatef(angles[1], 1, 0, 0);
GL11.glTranslated(0, -18 / 16F, 0);
armBase1.render(size);
armBase2.render(size);
supportMiddle.render(size);
GL11.glTranslated(0, 18 / 16F, 6 / 16F);
GL11.glRotatef(angles[2], 1, 0, 0);
GL11.glTranslated(0, -18 / 16F, -6 / 16F);
armMiddle1.render(size);
armMiddle2.render(size);
GL11.glTranslated(0, 3 / 16F, 6 / 16F);
GL11.glRotatef(angles[3], 1, 0, 0);
GL11.glTranslated(0, -3 / 16F, -6 / 16F);
drillBase.render(size);
GL11.glTranslated(0, 3 / 16F, 0);
GL11.glRotatef(angles[4], 0, 0, 1);
GL11.glTranslated(0, -3 / 16F, 0);
drill.render(size);
GL11.glPopMatrix();
}
示例3: onControllerDrag
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
protected void onControllerDrag()
{
Part part = selectedPart;
if(part instanceof PartObj || part instanceof PartRotation)
super.onControllerDrag();
else
{
GL11.glPushMatrix();
if(part instanceof PartEntityPos)
GL11.glTranslated(-entityToRender.posX, -entityToRender.posY, -entityToRender.posZ);
int i = translationAxisPlane == 0 ? 2 : translationAxisPlane - 1;
translationGuidePoint = getMouseVectorInPlane(i);
processAxisDrag();
GL11.glPopMatrix();
}
}
示例4: drawPlusAndMinus
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void drawPlusAndMinus() {
double scale = 0.05D;
GL11.glPushMatrix();
GL11.glTranslated(0.26D, 13.95D / 16D, 0);
GL11.glRotated(90, 1, 0, 0);
GL11.glScaled(scale, scale, scale);
GL11.glColor4d(0, 1, 0, 1);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
bufferBuilder.pos(-1, 0, 0).endVertex();
bufferBuilder.pos(1, 0, 0).endVertex();
bufferBuilder.pos(0, -1, 0).endVertex();
bufferBuilder.pos(0, 1, 0).endVertex();
tessellator.draw();
GL11.glTranslated(-0.52D / scale, 0, 0);
GL11.glColor4d(1, 0, 0, 1);
bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
bufferBuilder.pos(-1, 0, 0).endVertex();
bufferBuilder.pos(1, 0, 0).endVertex();
tessellator.draw();
GL11.glColor4d(1, 1, 1, 1);
GL11.glPopMatrix();
}
示例5: renderPreview
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private void renderPreview() {
if (!hasTicked) {
TileEntityPneumaticBase tile = (TileEntityPneumaticBase) getTube();
NetworkHandler.sendToServer(new PacketDescriptionPacketRequest(tile.getPos()));
TileEntity neighbor = tile.getWorld().getTileEntity(tile.getPos().offset(dir));
inLine = neighbor instanceof IPneumaticMachine;
if (inLine) {
IAirHandler neighborHandler = ((IPneumaticMachine) neighbor).getAirHandler(dir);
inverted = neighborHandler != null && neighborHandler.getPressure() > tile.getAirHandler(null).getPressure();
NetworkHandler.sendToServer(new PacketDescriptionPacketRequest(neighbor.getPos()));
}
hasTicked = true;
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if (inLine && !inverted) {
GL11.glColor4d(0, 1, 0, 0.3);
} else {
GL11.glColor4d(1, 0, 0, 0.3);
}
GL11.glPushMatrix();
GL11.glTranslated(0, 1, 0.2 + ClientTickHandler.TICKS % 20 * 0.015);
GL11.glRotated(90, 1, 0, 0);
RenderUtils.render3DArrow();
GL11.glColor4d(1, 1, 1, 0.5); // 0.5 because we're rendering a preview
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_BLEND);
}
示例6: 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();
}
示例7: onRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void onRender(float partialTicks)
{
// GL settings
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1F, 0F, 0F, 0.15F);
GL11.glPushMatrix();
GL11.glTranslated(-mc.getRenderManager().renderPosX,
-mc.getRenderManager().renderPosY,
-mc.getRenderManager().renderPosZ);
// vertices
GL11.glBegin(GL11.GL_QUADS);
{
for(int[] vertex : vertices)
GL11.glVertex3d(vertex[0], vertex[1], vertex[2]);
}
GL11.glEnd();
GL11.glPopMatrix();
// GL resets
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
}
示例8: onRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void onRender(float partialTicks)
{
// GL settings
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glLineWidth(2);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glPushMatrix();
GL11.glTranslated(-mc.getRenderManager().renderPosX,
-mc.getRenderManager().renderPosY,
-mc.getRenderManager().renderPosZ);
// minecart interpolation
ArrayList<AxisAlignedBB> minecartBoxes =
new ArrayList<>(minecarts.size());
minecarts.forEach(e -> {
double offsetX = -(e.posX - e.lastTickPosX)
+ (e.posX - e.lastTickPosX) * partialTicks;
double offsetY = -(e.posY - e.lastTickPosY)
+ (e.posY - e.lastTickPosY) * partialTicks;
double offsetZ = -(e.posZ - e.lastTickPosZ)
+ (e.posZ - e.lastTickPosZ) * partialTicks;
minecartBoxes.add(e.boundingBox.offset(offsetX, offsetY, offsetZ));
});
GL11.glCallList(normalChests);
GL11.glColor4f(0, 1, 0, 0.25F);
renderBoxes(minecartBoxes, solidBox);
GL11.glColor4f(0, 1, 0, 0.5F);
renderBoxes(minecartBoxes, outlinedBox);
GL11.glPopMatrix();
// GL resets
GL11.glColor4f(1, 1, 1, 1);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
示例9: onRenderGUI
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void onRenderGUI()
{
if(target == null)
return;
// GL settings
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glPushMatrix();
String message;
if(velocity < 1)
message = "Charging: " + (int)(velocity * 100) + "%";
else
message = "Ready To Shoot";
// translate to center
ScaledResolution sr = new ScaledResolution(mc);
int msgWidth = Fonts.segoe15.getStringWidth(message);
GL11.glTranslated(sr.getScaledWidth() / 2 - msgWidth / 2,
sr.getScaledHeight() / 2 + 1, 0);
// background
GL11.glColor4f(0, 0, 0, 0.5F);
GL11.glBegin(GL11.GL_QUADS);
{
GL11.glVertex2d(0, 0);
GL11.glVertex2d(msgWidth + 3, 0);
GL11.glVertex2d(msgWidth + 3, 10);
GL11.glVertex2d(0, 10);
}
GL11.glEnd();
// text
GL11.glEnable(GL11.GL_TEXTURE_2D);
Fonts.segoe15.drawString(message, 2, -1, 0xffffffff);
GL11.glPopMatrix();
// GL resets
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
}
示例10: doRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
if (!(entity instanceof EntityExplosiveAirGun) && !(entity instanceof EntityBasicAirGun)) {
return;
}
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthMask(false);
Tessellator tessellator = Tessellator.instance;
double r = entity.width / 2;
GL11.glColor4f(0.5F, 0.5F, 0.5F, 0.5F);
for (int i = 0; i < 4; ++i) {
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, 1.0F);
tessellator.startDrawingQuads();
tessellator.addVertex( r, -r, r); // 右下
tessellator.addVertex( r, r, r); // 右上
tessellator.addVertex(-r, r, r); // 左上
tessellator.addVertex(-r, -r, r); // 左下
tessellator.draw();
}
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
for (int i = 0; i < 2; ++i) {
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, 1.0F);
tessellator.startDrawingQuads();
tessellator.addVertex( r, -r, r); // 右下
tessellator.addVertex( r, r, r); // 右上
tessellator.addVertex(-r, r, r); // 左上
tessellator.addVertex(-r, -r, r); // 左下
tessellator.draw();
}
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
}
示例11: drawStrip
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawStrip(int x, int y, float width, double angle, float points, float radius, int color) {
float yc;
float xc;
float a;
int i;
float f1 = (float)(color >> 24 & 255) / 255.0f;
float f2 = (float)(color >> 16 & 255) / 255.0f;
float f3 = (float)(color >> 8 & 255) / 255.0f;
float f4 = (float)(color & 255) / 255.0f;
GL11.glPushMatrix();
GL11.glTranslated((double)x, (double)y, (double)0.0);
GL11.glColor4f((float)f2, (float)f3, (float)f4, (float)f1);
GL11.glLineWidth((float)width);
if (angle > 0.0) {
GL11.glBegin((int)3);
i = 0;
while ((double)i < angle) {
a = (float)((double)i * (angle * 3.141592653589793 / (double)points));
xc = (float)(Math.cos(a) * (double)radius);
yc = (float)(Math.sin(a) * (double)radius);
GL11.glVertex2f((float)xc, (float)yc);
++i;
}
GL11.glEnd();
}
if (angle < 0.0) {
GL11.glBegin((int)3);
i = 0;
while ((double)i > angle) {
a = (float)((double)i * (angle * 3.141592653589793 / (double)points));
xc = (float)(Math.cos(a) * (double)(- radius));
yc = (float)(Math.sin(a) * (double)(- radius));
GL11.glVertex2f((float)xc, (float)yc);
--i;
}
GL11.glEnd();
}
RenderUtils.disableGL2D();
GL11.glDisable((int)3479);
GL11.glPopMatrix();
}
示例12: translate
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void translate(double x, double y, double z)
{
GL11.glTranslated(x, y, z);
}
示例13: onRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void onRender(float partialTicks)
{
if(currentBlock == null)
return;
// GL settings
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glLineWidth(2);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glPushMatrix();
GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX,
-TileEntityRendererDispatcher.staticPlayerY,
-TileEntityRendererDispatcher.staticPlayerZ);
AxisAlignedBB box = new AxisAlignedBB(BlockPos.ORIGIN);
float p = prevProgress + (progress - prevProgress) * partialTicks;
float red = p * 2F;
float green = 2 - red;
GL11.glTranslated(currentBlock.getX(), currentBlock.getY(),
currentBlock.getZ());
if(p < 1)
{
GL11.glTranslated(0.5, 0.5, 0.5);
GL11.glScaled(p, p, p);
GL11.glTranslated(-0.5, -0.5, -0.5);
}
GL11.glColor4f(red, green, 0, 0.25F);
RenderUtils.drawSolidBox(box);
GL11.glColor4f(red, green, 0, 0.5F);
RenderUtils.drawOutlinedBox(box);
GL11.glPopMatrix();
// GL resets
GL11.glColor4f(1, 1, 1, 1);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
示例14: onRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void onRender(float partialTicks)
{
// GL settings
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glLineWidth(2);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glPushMatrix();
GL11.glTranslated(-mc.getRenderManager().renderPosX,
-mc.getRenderManager().renderPosY,
-mc.getRenderManager().renderPosZ);
// set start position
Vec3d start = RotationUtils.getClientLookVec()
.addVector(0, WMinecraft.getPlayer().getEyeHeight(), 0)
.addVector(mc.getRenderManager().renderPosX,
mc.getRenderManager().renderPosY,
mc.getRenderManager().renderPosZ);
GL11.glBegin(GL11.GL_LINES);
for(EntityPlayer entity : WMinecraft.getWorld().playerEntities)
{
if(entity == WMinecraft.getPlayer()
|| entity instanceof EntityFakePlayer)
continue;
// fake entities with crazy vertical position
if(Math.abs(entity.posY - WMinecraft.getPlayer().posY) > 1e6)
continue;
if(!wurst.special.targetSpf.sleepingPlayers.isChecked()
&& entity.isPlayerSleeping())
continue;
if(!wurst.special.targetSpf.invisiblePlayers.isChecked()
&& entity.isInvisible())
continue;
// set end position
Vec3d end = entity.boundingBox.getCenter()
.subtract(new Vec3d(entity.posX, entity.posY, entity.posZ)
.subtract(entity.prevPosX, entity.prevPosY, entity.prevPosZ)
.scale(1 - partialTicks));
// set color
if(wurst.friends.contains(entity.getName()))
GL11.glColor4f(0, 0, 1, 0.5F);
else
{
float factor =
WMinecraft.getPlayer().getDistanceToEntity(entity) / 40F;
if(factor > 1)
factor = 1;
GL11.glColor4f(2 - factor * 2F, factor * 2F, 0, 0.5F);
}
// draw line
GL11.glVertex3d(start.xCoord, start.yCoord, start.zCoord);
GL11.glVertex3d(end.xCoord, end.yCoord, end.zCoord);
}
GL11.glEnd();
GL11.glPopMatrix();
// GL resets
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
示例15: renderModel
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void renderModel(float size, float[] angles, boolean laserOn) {
GlStateManager.pushMatrix();
GL11.glRotatef(angles[0], 0, 1, 0);
baseTurn.render(size);
baseTurn2.render(size);
GL11.glTranslated(0, 18 / 16F, 0);
GL11.glRotatef(angles[1], 1, 0, 0);
GL11.glTranslated(0, -18 / 16F, 0);
armBase1.render(size);
armBase2.render(size);
supportMiddle.render(size);
GL11.glTranslated(0, 18 / 16F, 6 / 16F);
GL11.glRotatef(angles[2], 1, 0, 0);
GL11.glTranslated(0, -18 / 16F, -6 / 16F);
armMiddle1.render(size);
armMiddle2.render(size);
GL11.glTranslated(0, 3 / 16F, 6 / 16F);
GL11.glRotatef(angles[3], 1, 0, 0);
GL11.glTranslated(0, -3 / 16F, -6 / 16F);
laserBase.render(size);
if (laserOn) {
GL11.glPushMatrix();
GL11.glTranslated(0, 2.75 / 16D, 1 / 16D);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor4d(1.0D, 0.1D, 0, 1);
laser.render(size / 8);
GL11.glPopMatrix();
GL11.glColor4d(1, 1, 1, 1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
double textSize = 1 / 150D;
GL11.glScaled(textSize, textSize, textSize);
GL11.glRotated(-90, 1, 0, 0);
GL11.glTranslated(0, 0, 18);
GL11.glDisable(GL11.GL_LIGHTING);
GuiPneumaticContainerBase.drawTexture(Textures.GUI_LASER_DANGER, -8, -65);
GL11.glEnable(GL11.GL_LIGHTING);
GlStateManager.popMatrix();
}