List of usage examples for org.lwjgl.opengl GL11 glPopMatrix
public static native void glPopMatrix();
From source file:basedefense.client.renderer.item.surveillance.GooglyEyeRenderer.java
License:Apache License
/** * Handles {@link RenderLivingEvent}.//from w w w.j a v a 2 s . co m * * @param event The event. */ @SubscribeEvent public void onRenderLiving(RenderLivingEvent.Post event) { EntityLivingBase entity = event.entity; if (!GooglyGlassesItem.ITEM.isPlayerWearing()) return; EntityConfiguration configuration = EntityConfiguration.valueOf(entity.getClass()); if (configuration == null) return; GL11.glPushMatrix(); { GL11.glTranslated(event.x, event.y, event.z); GL11.glTranslatef(0.0f, configuration.getRotationCenterY(), 0.0f); GL11.glRotatef(entity.getRotationYawHead(), 0.0f, -1.0f, 0.0f); GL11.glPushMatrix(); { GL11.glRotatef(entity.rotationPitch, 1.0f, 0.0f, 0.0f); GL11.glTranslatef(0.0f, configuration.getEyeOffsetY(), configuration.getEyeOffsetZ()); this.renderModel(configuration.getEyeOffsetX(), configuration.getEyeScale()); this.renderModel(-configuration.getEyeOffsetX(), configuration.getEyeScale()); } GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:basedefense.client.renderer.item.surveillance.GooglyEyeRenderer.java
License:Apache License
/** * Renders the model at a certain distance from the center. * * @param distance The distance.//from w w w . j a v a2 s . c om * @param scale The model scale. */ private void renderModel(float distance, float scale) { GL11.glPushMatrix(); { GL11.glTranslatef(distance, 0.0f, 0.0f); GL11.glScalef(scale, scale, scale); Minecraft.getMinecraft().renderEngine.bindTexture( new ResourceLocation("basedefense2", "textures/models/surveillance_googly_eye.png")); EYE_MODEL.renderAll(); } GL11.glPopMatrix(); }
From source file:bau5.mods.projectbench.client.RenderCraftingFrame.java
License:LGPL
private void render(EntityCraftingFrame entity, double x, double y, double z, float par8, float par9) { if (renderBlocks.blockAccess == null) renderBlocks.blockAccess = entity.worldObj; GL11.glPushMatrix();//from w w w . ja v a2 s .c o m float f2 = (float) (entity.posX - x) - 0.5F; float f3 = (float) (entity.posY - y) - 0.5F; float f4 = (float) (entity.posZ - z) - 0.5F; int i = entity.xPosition + Direction.offsetX[entity.hangingDirection]; int j = entity.yPosition; int k = entity.zPosition + Direction.offsetZ[entity.hangingDirection]; float f5 = i - f2; float f6 = j - f3; float f7 = k - f4; GL11.glTranslatef(i - f2, j - f3, k - f4); renderFrameItemAsBlock(entity); renderItemInFrame(entity); GL11.glPopMatrix(); }
From source file:bau5.mods.projectbench.client.RenderCraftingFrame.java
License:LGPL
private void renderItemInFrame(EntityCraftingFrame entity) { ItemStack itemstack = entity.getDisplayedItem(); if (itemstack != null) { EntityItem entityitem = new EntityItem(entity.worldObj, 0.0D, 0.0D, 0.0D, itemstack); entityitem.getEntityItem().stackSize = 1; entityitem.hoverStart = 0.0F;/*from w w w . j a va 2s .c o m*/ GL11.glPushMatrix(); GL11.glTranslatef(-0.453125F * Direction.offsetX[entity.hangingDirection], -0.18F, -0.453125F * Direction.offsetZ[entity.hangingDirection]); GL11.glRotatef(180.0F + entity.rotationYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef((-90 * entity.getRotation()), 0.0F, 0.0F, 1.0F); switch (entity.getRotation()) { case 1: GL11.glTranslatef(-0.16F, -0.16F, 0.0F); break; case 2: GL11.glTranslatef(0.0F, -0.32F, 0.0F); break; case 3: GL11.glTranslatef(0.16F, -0.16F, 0.0F); } RenderItem.renderInFrame = true; RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; GL11.glPopMatrix(); } }
From source file:bau5.mods.projectbench.client.RenderCraftingFrame.java
License:LGPL
private void renderFrameItemAsBlock(EntityItemFrame eif) { GL11.glPushMatrix();//from w w w .ja v a 2s . c o m this.renderManager.renderEngine.func_110577_a(TextureMap.field_110575_b); GL11.glRotatef(eif.rotationYaw, 0.0F, 1.0F, 0.0F); Block block = Block.planks; float f = 0.0625F; float f1 = 0.75F; float f2 = f1 / 2.0F; GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2 + 0.0625F), (0.5F - f2 + 0.0625F), (f * 0.5F), (0.5F + f2 - 0.0625F), (0.5F + f2 - 0.0625F)); this.renderBlocks.setOverrideBlockTexture(ProjectBench.instance.projectBench.getIcon(1, 0)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); this.renderBlocks.clearOverrideBlockTexture(); this.renderBlocks.unlockBlockBounds(); GL11.glPopMatrix(); this.renderBlocks.setOverrideBlockTexture(Block.planks.getIcon(1, 1)); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F - f2), (f + 1.0E-4F), (f + 0.5F - f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F + f2 - f), (0.5F - f2), (f + 1.0E-4F), (0.5F + f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F - f2), f, (0.5F + f2), (f + 0.5F - f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F + f2 - f), f, (0.5F + f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); this.renderBlocks.unlockBlockBounds(); this.renderBlocks.clearOverrideBlockTexture(); GL11.glPopMatrix(); }
From source file:bau5.mods.projectbench.client.RenderCraftingFrameII.java
License:LGPL
private void render(EntityCraftingFrameII entity, double x, double y, double z, float par8, float par9) { if (renderBlocks.blockAccess == null) renderBlocks.blockAccess = entity.worldObj; GL11.glPushMatrix();// w w w . j a va 2 s . c o m float f2 = (float) (entity.posX - x) - 0.5F; float f3 = (float) (entity.posY - y) - 0.5F; float f4 = (float) (entity.posZ - z) - 0.5F; int i = entity.xPosition + Direction.offsetX[entity.hangingDirection]; int j = entity.yPosition; int k = entity.zPosition + Direction.offsetZ[entity.hangingDirection]; float f5 = i - f2; float f6 = j - f3; float f7 = k - f4; GL11.glTranslatef(i - f2, j - f3, k - f4); renderFrameItemAsBlock(entity); renderItemInFrame(entity); GL11.glPopMatrix(); }
From source file:bau5.mods.projectbench.client.RenderCraftingFrameII.java
License:LGPL
private void renderItemInFrame(EntityCraftingFrameII entity) { ItemStack itemstack = entity.getDisplayedItem(); if (itemstack != null) { EntityItem entityitem = new EntityItem(entity.worldObj, 0.0D, 0.0D, 0.0D, itemstack); entityitem.hoverStart = 0.0F;/*from w w w .j av a2 s . c o m*/ GL11.glPushMatrix(); GL11.glTranslatef(-0.453125F * Direction.offsetX[entity.hangingDirection], -0.18F, -0.453125F * Direction.offsetZ[entity.hangingDirection]); GL11.glRotatef(180.0F + entity.rotationYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef((-90 * entity.getRotation()), 0.0F, 0.0F, 1.0F); switch (entity.getRotation()) { case 1: GL11.glTranslatef(-0.16F, -0.16F, 0.0F); break; case 2: GL11.glTranslatef(0.0F, -0.32F, 0.0F); break; case 3: GL11.glTranslatef(0.16F, -0.16F, 0.0F); } RenderItem.renderInFrame = true; RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; GL11.glPopMatrix(); } }
From source file:bau5.mods.projectbench.client.RenderCraftingFrameII.java
License:LGPL
private void renderFrameItemAsBlock(EntityItemFrame eif) { GL11.glPushMatrix();//from w w w . j a v a 2s . c o m this.renderManager.renderEngine.func_110577_a(TextureMap.field_110575_b); GL11.glRotatef(eif.rotationYaw, 0.0F, 1.0F, 0.0F); Block block = Block.planks; float f = 0.0625F; float f1 = 0.75F; float f2 = f1 / 2.0F; GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2 + 0.0625F), (0.5F - f2 + 0.0625F), (f * 0.5F), (0.5F + f2 - 0.0625F), (0.5F + f2 - 0.0625F)); this.renderBlocks.setOverrideBlockTexture(Block.workbench.getBlockTextureFromSide(1)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); this.renderBlocks.clearOverrideBlockTexture(); this.renderBlocks.unlockBlockBounds(); GL11.glPopMatrix(); this.renderBlocks.setOverrideBlockTexture(Block.planks.getIcon(1, 1)); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F - f2), (f + 1.0E-4F), (f + 0.5F - f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F + f2 - f), (0.5F - f2), (f + 1.0E-4F), (0.5F + f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F - f2), f, (0.5F + f2), (f + 0.5F - f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F + f2 - f), f, (0.5F + f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); this.renderBlocks.unlockBlockBounds(); this.renderBlocks.clearOverrideBlockTexture(); GL11.glPopMatrix(); }
From source file:bd.ac.seu.lwjgldemo.Renderer.java
private void drawSomething() { GL11.glClearColor(0, 0, 0, 1);/*from w w w . j a v a 2s .c o m*/ GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glColor3f(1, 1, 0); GL11.glPushMatrix(); GL11.glRotatef(angle, 0, 0, 1); /* GL11.glBegin(GL11.GL_QUADS); for (int row = 0; row < vertices.length; row = row + 3) { double x = vertices[row]; double y = vertices[row + 1]; double z = vertices[row + 2]; GL11.glVertex3d(x, y, z); } GL11.glEnd(); */ GL30.glBindVertexArray(vaoId); GL20.glEnableVertexAttribArray(0); // Draw the vertices GL11.glDrawArrays(GL11.GL_QUADS, 0, vertices.length / 3); // Put everything back to default (deselect) GL20.glDisableVertexAttribArray(0); GL30.glBindVertexArray(0); GL11.glPopMatrix(); angle = angle + .10f; frameCounter++; long currentTime = System.nanoTime(); long timeDifference = currentTime - lastTime; double fps = 1000000000.0 / timeDifference; System.out.printf("FPS: %.3f\n", fps); lastTime = currentTime; }
From source file:boilerplate.client.fx.FXRaygun.java
License:Minecraft Mod Public
@Override public void renderParticle(final Tessellator tessellator, final float f, final float f1, final float f2, final float f3, final float f4, final float f5) { tessellator.draw();/*from ww w. jav a2 s. co m*/ GL11.glPushMatrix(); final float var9 = 1.0F; final float slide = this.worldObj.getWorldTime(); final float rot = ((this.worldObj.provider.getWorldTime() % (360 / this.rotationspeed)) * this.rotationspeed) + (this.rotationspeed * f); float size = 0.5F; if (this.pulse) { size = Math.min(this.particleAge / 4.0F, 1.0F); size = this.prevSize + ((size - this.prevSize) * f); } float op = 0.4F; if ((this.pulse) && ((this.particleMaxAge - this.particleAge) <= 4)) { op = 0.4F - ((4 - (this.particleMaxAge - this.particleAge)) * 0.1F); } switch (this.type) { default: // In case I make another type of beam, I can change the beam // texture here break; case 1: // and here... break; case 2: ClientHelper.textureManager().bindTexture(rayTex); } GL11.glTexParameterf(3553, 10242, 10497.0F); GL11.glTexParameterf(3553, 10243, 10497.0F); GL11.glDisable(2884); float var11 = slide + f; if (this.reverse) { var11 *= -1.0F; // why name your variables "var11"? That is so // un-helpful } final float var12 = (-var11 * 0.2F) - MathHelper.floor_float(-var11 * 0.1F); GL11.glEnable(3042); GL11.glBlendFunc(770, 1); GL11.glDepthMask(false); double prex = this.player.prevPosX; double prey = this.player.prevPosY + this.offset; double prez = this.player.prevPosZ; double px = this.player.posX; double py = this.player.posY + this.offset; double pz = this.player.posZ; prex -= MathHelper.cos((this.player.prevRotationYaw / 180.0F) * 3.141593F) * 0.066F; prey -= 0.06D; prez -= MathHelper.sin((this.player.prevRotationYaw / 180.0F) * 3.141593F) * 0.04F; Vec3 vec3d = this.player.getLook(1.0F); prex += vec3d.xCoord * 0.3D; prey += vec3d.yCoord * 0.3D; prez += vec3d.zCoord * 0.3D; px -= MathHelper.cos((this.player.rotationYaw / 180.0F) * 3.141593F) * 0.066F; py -= 0.06D; pz -= MathHelper.sin((this.player.rotationYaw / 180.0F) * 3.141593F) * 0.04F; vec3d = this.player.getLook(1.0F); px += vec3d.xCoord * 0.3D; py += vec3d.yCoord * 0.3D; pz += vec3d.zCoord * 0.3D; final float xx = (float) ((prex + ((px - prex) * f)) - EntityFX.interpPosX); final float yy = (float) ((prey + ((py - prey) * f)) - EntityFX.interpPosY); final float zz = (float) ((prez + ((pz - prez) * f)) - EntityFX.interpPosZ); GL11.glTranslated(xx, yy, zz); final float ry = this.prevYaw + ((this.rotYaw - this.prevYaw) * f); final float rp = this.prevPitch + ((this.rotPitch - this.prevPitch) * f); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(180.0F + ry, 0.0F, 0.0F, -1.0F); GL11.glRotatef(rp, 1.0F, 0.0F, 0.0F); final double var44 = -0.15D * size; final double var17 = 0.15D * size; final double var44b = -0.15D * size * this.endMod; final double var17b = 0.15D * size * this.endMod; GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F); for (int t = 0; t < 5; t++) { final double var29 = this.length * size * var9; final double var31 = 0.0D; final double var33 = 1.0D; final double var35 = -1.0F + var12 + (t / 3.0F); final double var37 = (this.length * size * var9) + var35; GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.setBrightness(200); tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, op); tessellator.addVertexWithUV(var44b, var29, 0.0D, var33, var37); tessellator.addVertexWithUV(var44, 0.0D, 0.0D, var33, var35); tessellator.addVertexWithUV(var17, 0.0D, 0.0D, var31, var35); tessellator.addVertexWithUV(var17b, var29, 0.0D, var31, var37); tessellator.draw(); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDepthMask(true); GL11.glDisable(3042); GL11.glEnable(2884); GL11.glPopMatrix(); tessellator.startDrawingQuads(); this.prevSize = size; }