List of usage examples for org.lwjgl.opengl GL11 glRotatef
public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:bd.ac.seu.lwjgldemo.Renderer.java
private void drawSomething() { GL11.glClearColor(0, 0, 0, 1);/* w ww . j a v a 2 s . 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();// ww w . j ava2s . c o 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; }
From source file:boilerplate.client.renderers.block.BlockTESRRenderer.java
License:Minecraft Mod Public
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); TileEntityRendererDispatcher.instance.renderTileEntityAt(this.tile, 0.0D, 0.0D, 0.0D, 0.0F); GL11.glEnable(32826);// w w w . j a v a 2 s . c om }
From source file:boilerplate.client.renderers.block.RenderMinedBlock.java
License:Minecraft Mod Public
public void doRender(EntityMinedBlock entBlock, double posX, double posY, double posZ, float f, float renderTick) { World world = entBlock.getWorldObj(); Block block = entBlock.getBlock();/*w ww .j a v a 2s. co m*/ MathHelper.floor_double(entBlock.posX); MathHelper.floor_double(entBlock.posY); MathHelper.floor_double(entBlock.posZ); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); GL11.glTranslatef((float) posX, (float) posY, (float) posZ); this.bindEntityTexture(entBlock); float scale = entBlock.scale; float rot = world.getWorldTime() * 17.6F; GL11.glScalef(scale, scale, scale); if (entBlock.doesRotate) GL11.glRotatef(rot, 0 - world.rand.nextFloat(), 0 - world.rand.nextFloat(), 0 - world.rand.nextFloat()); this.blockRenderer.blockAccess = entBlock.worldObj; this.blockRenderer.useInventoryTint = true; this.blockRenderer.setRenderBoundsFromBlock(block); this.blockRenderer.renderBlockAsItem(block, entBlock.metadata, 1.0F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:boilerplate.client.renderers.RenderFloatingItem.java
License:Minecraft Mod Public
public static void render(double dx, double dy, double dz, float rotX, float rotY, float rotZ, ItemStack stack) {//from w ww.j ava 2s . c o m EntityItem entItem = new EntityItem(ClientHelper.world(), 0D, 0D, 0D, stack); // Without the below line, the item will spazz out entItem.hoverStart = 0.0F; RenderItem.renderInFrame = true; GL11.glTranslatef((float) dx, (float) dy, (float) dz); GL11.glRotatef(rotX, 1, 0, 0); GL11.glRotatef(rotY, 0, 1, 0); GL11.glRotatef(rotZ, 0, 0, 1); GL11.glScalef(1.3F, 1.3F, 1.3F); RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; }
From source file:boilerplate.client.renderers.RenderFloatingItem.java
License:Minecraft Mod Public
public static void render(double dx, double dy, double dz, float rotX, float rotY, float rotZ, float scaleX, float scaleY, float scaleZ, ItemStack stack) { EntityItem entItem = new EntityItem(ClientHelper.world(), 0D, 0D, 0D, stack); // Without the below line, the item will spazz out entItem.hoverStart = 0.0F;/* w ww. j a v a 2s. c o m*/ RenderItem.renderInFrame = true; GL11.glTranslatef((float) dx, (float) dy, (float) dz); GL11.glRotatef(rotX, 1, 0, 0); GL11.glRotatef(rotY, 0, 1, 0); GL11.glRotatef(rotZ, 0, 0, 1); GL11.glScalef(scaleX, scaleY, scaleZ); RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; }
From source file:buildcraft.core.lib.render.RenderEntityBlock.java
License:Minecraft Mod Public
public void doRenderBlock(EntityBlock entity, double x, double y, double z) { if (entity.isDead) { return;/*from www .ja v a2 s . c o m*/ } shadowSize = entity.shadowSize; RenderInfo util = new RenderInfo(); util.textureArray = entity.texture; bindTexture(TextureMap.locationBlocksTexture); int iMax = (int) Math.ceil(entity.iSize) - 1; int jMax = (int) Math.ceil(entity.jSize) - 1; int kMax = (int) Math.ceil(entity.kSize) - 1; GL11.glTranslatef((float) x, (float) y, (float) z); for (int iBase = 0; iBase <= iMax; ++iBase) { for (int jBase = 0; jBase <= jMax; ++jBase) { for (int kBase = 0; kBase <= kMax; ++kBase) { util.renderSide[0] = jBase == 0; util.renderSide[1] = jBase == jMax; util.renderSide[2] = kBase == 0; util.renderSide[3] = kBase == kMax; util.renderSide[4] = iBase == 0; util.renderSide[5] = iBase == iMax; if (util.renderSide[0] || util.renderSide[1] || util.renderSide[2] || util.renderSide[3] || util.renderSide[4] || util.renderSide[5]) { util.minX = 0; util.minY = 0; util.minZ = 0; double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.maxX = remainX > 1.0 ? 1.0 : remainX; util.maxY = remainY > 1.0 ? 1.0 : remainY; util.maxZ = remainZ > 1.0 ? 1.0 : remainZ; GL11.glPushMatrix(); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); renderBlock(util); GL11.glPopMatrix(); } } } } GL11.glTranslatef((float) -x, (float) -y, (float) -z); }
From source file:buildcraft.core.render.RenderEntityBlock.java
License:Minecraft Mod Public
public void doRenderBlock(EntityBlock entity, double i, double j, double k) { if (entity.isDead) { return;//from www . j av a 2 s.co m } shadowSize = entity.shadowSize; World world = entity.worldObj; RenderInfo util = new RenderInfo(); util.texture = entity.texture; bindTexture(TextureMap.locationBlocksTexture); for (int iBase = 0; iBase < entity.iSize; ++iBase) { for (int jBase = 0; jBase < entity.jSize; ++jBase) { for (int kBase = 0; kBase < entity.kSize; ++kBase) { util.minX = 0; util.minY = 0; util.minZ = 0; double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.maxX = remainX > 1.0 ? 1.0 : remainX; util.maxY = remainY > 1.0 ? 1.0 : remainY; util.maxZ = remainZ > 1.0 ? 1.0 : remainZ; GL11.glPushMatrix(); GL11.glTranslatef((float) i, (float) j, (float) k); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); int lightX, lightY, lightZ; lightX = (int) (Math.floor(entity.posX) + iBase); lightY = (int) (Math.floor(entity.posY) + jBase); lightZ = (int) (Math.floor(entity.posZ) + kBase); GL11.glDisable(2896 /* GL_LIGHTING */); renderBlock(util, world, 0, 0, 0, lightX, lightY, lightZ, false, true); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } } }
From source file:buildcraft.core.render.RenderLaser.java
License:Minecraft Mod Public
public static void doRenderLaserWave(TextureManager textureManager, LaserData laser, ResourceLocation texture) { if (!laser.isVisible || texture == null) { return;//from w ww. j a va 2s.c o m } GL11.glPushMatrix(); laser.update(); GL11.glRotatef((float) laser.angleZ, 0, 1, 0); GL11.glRotatef((float) laser.angleY, 0, 0, 1); textureManager.bindTexture(texture); float factor = (float) (1.0 / 16.0); int indexList = 0; initScaledBoxes(); double x0 = 0; double x1 = laser.wavePosition; double x2 = x1 + scaledBoxes[0].length * STEP; double x3 = laser.renderSize; doRenderLaserLine(x1, laser.laserTexAnimation); for (double i = x1; i <= x2 && i <= laser.renderSize; i += STEP) { GL11.glCallList(scaledBoxes[(int) (laser.waveSize * 99F)][indexList]); indexList = (indexList + 1) % scaledBoxes[0].length; GL11.glTranslated(STEP, 0, 0); } if (x2 < x3) { doRenderLaserLine(x3 - x2, laser.laserTexAnimation); } GL11.glPopMatrix(); }
From source file:buildcraft.core.render.RenderLaser.java
License:Minecraft Mod Public
public static void doRenderLaser(TextureManager textureManager, LaserData laser, ResourceLocation texture) { if (!laser.isVisible || texture == null) { return;// www. j a v a2s . c o m } GL11.glPushMatrix(); GL11.glTranslated(laser.head.x, laser.head.y, laser.head.z); laser.update(); GL11.glRotatef((float) laser.angleZ, 0, 1, 0); GL11.glRotatef((float) laser.angleY, 0, 0, 1); textureManager.bindTexture(texture); float factor = (float) (1.0 / 16.0); float lasti = 0; int indexList = (int) ((new Date().getTime() / 100) % 20); initScaledBoxes(); doRenderLaserLine(laser.renderSize, laser.laserTexAnimation); GL11.glPopMatrix(); }