List of usage examples for org.lwjgl.opengl GL11 glEnable
public static void glEnable(@NativeType("GLenum") int target)
From source file:com.ethylamine.fsynthesis.client.renderer.tileentity.TungstenChestTESR.java
License:Open Source License
private void renderTungstenChest(TungstenChestTE te, float tick) { final int x = te.xCoord; final int y = te.yCoord; final int z = te.zCoord; final World world = te.getWorldObj(); GL11.glPushMatrix();/*from w w w . jav a 2 s.com*/ // Position Renderer bindTexture(TEXTURE); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(1.0F, -1.0F, -1.0F); //flip & rotate GL11.glTranslatef(0.5F, 0.5F, 0.5F); //translate block pos around fromBLK ORG final int metadata = world.getBlockMetadata(x, y, z); final Orientation orientation = Orientation.getdecodedOrientation(metadata); GL11.glRotatef(getAngleFromOrientation(orientation), 0.0F, -1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); //translate BLK ORG to block pos //lid angle. float adjLDAngle = te.getPrevLidAngle() + (te.getLidAngle() - te.getPrevLidAngle()) * tick; adjLDAngle = 1.0F - adjLDAngle; adjLDAngle = 1.0F - adjLDAngle * adjLDAngle * adjLDAngle; //noinspection NumericCastThatLosesPrecision vanillaChest.chestLid.rotateAngleX = -(adjLDAngle * (float) Math.PI / 2.0F); vanillaChest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:com.fatality.skillcraft.api.utils.GuiSliderButton.java
License:Open Source License
public void drawButton(Minecraft mc, int i, int j) { if (this.visible) { boolean flag = Mouse.isButtonDown(0); int k1 = this.xPosition; int k2 = k1 + this.width; int l1 = this.yPosition; int l2 = l1 + (int) maxValue; if (flag && i >= k1 && j >= l1 && i < k2 && j < l2) { this.isScrolling = true; }//from w ww .jav a 2 s. co m if (!flag) { this.isScrolling = false; } int scrollING = 0; if (isScrolling) { scrollING = this.width; } this.wasClicking = flag; mc.getTextureManager().bindTexture(texture); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.drawTexturedModalRect(this.xPosition, this.yPosition + (int) sliderValue, textureX + scrollING, textureY, this.width, this.height); this.mouseDragged(mc, i, j); } }
From source file:com.fireball1725.firelib.guimaker.GuiMakerGuiContainer.java
License:Open Source License
@SideOnly(Side.CLIENT) public void scissorCut(int x, int y, int w, int h) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); int scale = scaledResolution.getScaleFactor(); GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glScissor(x * scale, y * scale, w * scale, h * scale); }
From source file:com.fireball1725.firelib.renderer.layers.LayerSword.java
License:Open Source License
@SideOnly(Side.CLIENT) @Override/*from w ww. ja v a 2s. c o m*/ public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { UUID playerUUID = entitylivingbaseIn.getGameProfile().getId(); if (!Benihime.hasUser(playerUUID) || entitylivingbaseIn.isInvisible()) return; if (entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE)) return; if (entitylivingbaseIn.isSneaking()) { GlStateManager.translate(0.0f, 0.2f, 0.0f); GlStateManager.rotate(28.6479f, 1.0f, 0.0f, 0.0f); } Minecraft.getMinecraft().getTextureManager().bindTexture(swordTex); GlStateManager.rotate(90.0f, 1.0f, 0.0f, 0.0f); GlStateManager.translate(-0.25f, 0.14f, -0.05f); GlStateManager.rotate(-38.0f, 0.0f, 1.0f, 0.0f); swordModel.renderAllExcept("Benihime_Tassle"); if (entitylivingbaseIn.isSneaking()) { GlStateManager.translate(0.25f, -0.14f, 0.05f); GlStateManager.rotate(38.0f, 0.0f, 1.0f, 0.0f); GlStateManager.rotate(-28.6479f, 1.0f, 0.0f, 0.0f); GlStateManager.translate(-0.25f, 0.14f, -0.05f); GlStateManager.rotate(-38.0f, 0.0f, 1.0f, 0.0f); GlStateManager.translate(0.026f, -0.021f, -0.101f); } GL11.glDisable(GL11.GL_LIGHTING); double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * partialTicks); double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * partialTicks); double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * partialTicks); float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; double d3 = MathHelper.sin(f * 0.017453292f); double d4 = -MathHelper.cos(f * 0.017453292f); float f1 = MathHelper.clamp((float) d1 * 50.0f, -6.0f, 180.0f); float f2 = Math.max(0, (float) (d0 * d3 + d2 * d4) * 100.0f); float f3 = (float) (d0 * d4 - d2 * d3) * 100.0f; float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; f1 += MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0f) * 32.0f * f4; GlStateManager.rotate(-51f, 0f, 1f, 0f); GlStateManager.translate(0.2017f, 0.0242f, 0.235f); GlStateManager.rotate(Math.max(-f2 / 2.0f - f1, -180), 0.0f, 0.0f, 1.0f); GlStateManager.rotate(f3 / 2.0f, 0.0f, 1.0f, 0.0f); GlStateManager.rotate(-f3 / 2.0f, 1.0f, 0.0f, 0.0f); GlStateManager.translate(0.0585f, -0.026f, -0.3f); swordModel.renderOnly("Benihime_Tassle"); GL11.glEnable(GL11.GL_LIGHTING); }
From source file:com.flowpowered.caustic.lwjgl.gl20.GL20Context.java
License:MIT License
@Override public void enableCapability(Capability capability) { checkCreated();// w w w.jav a2 s .c om GL11.glEnable(capability.getGLConstant()); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.freyja.FES.client.renderers.ItemRenderInjector.java
License:LGPL
private void renderInjector(float x, float y, float z, float scale) { GL11.glPushMatrix();/*from w w w . j a va 2s. c o m*/ GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(x, y, z); GL11.glScalef(scale, scale, scale); GL11.glRotatef(180f, 0f, 1f, 0f); FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/FES/textures/injector.png"); modelInjector.render(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:com.gameminers.ethereal.architect.ModelCanvas.java
License:Open Source License
@Override protected void paintGL() { try {/*from w w w.jav a 2 s .c o m*/ if (getWidth() != current_width || getHeight() != current_height) { current_width = getWidth(); current_height = getHeight(); GL11.glViewport(0, 0, current_width, current_height); } GL11.glClearColor(0.0f, 0.6f, 0.5f, 1.0f); GL11.glClearDepth(1.0); GL11.glColor3f(1, 1, 1); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glLoadIdentity(); GLU.gluPerspective(45.0f, (float) getWidth() / (float) getHeight(), 0.1f, 1000.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glTranslatef(0, 0, zoom); GL11.glRotatef(angle, 0f, 1f, 0f); GL11.glRotatef(tilt, 1f, 0f, 0f); GL11.glTranslatef(-16, -16, -16); if (lit) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, lightPosition); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, lightAmbient); } else { GL11.glDisable(GL11.GL_LIGHTING); } if (textured) { GL11.glEnable(GL11.GL_TEXTURE_2D); } else { GL11.glDisable(GL11.GL_TEXTURE_2D); } if (model != null) { if (model.isAmbientOcclusionEnabled()) { GL11.glShadeModel(GL11.GL_SMOOTH); } else { GL11.glShadeModel(GL11.GL_FLAT); } for (ModelElement ele : model.getElements()) { GL11.glPushMatrix(); if (ele.isShade()) { GL11.glEnable(GL11.GL_LIGHTING); } else { GL11.glDisable(GL11.GL_LIGHTING); } float fromX = ele.getFrom()[0]; float fromY = ele.getFrom()[1]; float fromZ = ele.getFrom()[2]; float toX = ele.getTo()[0]; float toY = ele.getTo()[1]; float toZ = ele.getTo()[2]; float fX = (fromX > toX ? fromX : toX); float fY = (fromY > toY ? fromY : toY); float fZ = (fromZ > toZ ? fromZ : toZ); float tX = (fromX > toX ? toX : fromX); float tY = (fromY > toY ? toY : fromY); float tZ = (fromZ > toZ ? toZ : fromZ); GL11.glTranslatef(fX, fY, fZ); float scaleX = tX - fX; float scaleY = tY - fY; float scaleZ = tZ - fZ; GL11.glBegin(GL11.GL_QUADS); GL11.glNormal3f(0, 0, -1f); for (int i = 0; i < vertices.length / 3; i++) { int faceIdx = i / 4; ModelFace face; switch (faceIdx) { case 0: face = ele.getFaces().getNorth(); break; case 1: face = ele.getFaces().getSouth(); break; case 2: face = ele.getFaces().getUp(); break; case 3: face = ele.getFaces().getDown(); break; case 4: face = ele.getFaces().getWest(); break; case 5: face = ele.getFaces().getEast(); break; default: face = null; break; } int idx = i * 3; float vX = vertices[idx] * scaleX; float vY = vertices[idx + 1] * scaleY; float vZ = vertices[idx + 2] * scaleZ; /*float u; float v; GL11.glTexCoord2f(u, v);*/ GL11.glVertex3f(vX, vY, vZ); } GL11.glEnd(); GL11.glPopMatrix(); } } GL11.glPopMatrix(); swapBuffers(); repaint(); } catch (LWJGLException e) { throw new RuntimeException(e); } }
From source file:com.gameminers.mav.component.TextField.java
License:Open Source License
@Override public void doRender() { if (viewPos > str.length()) { viewPos = str.length();/* w w w. jav a2 s .c o m*/ } else if (viewPos < 0) { viewPos = 0; } frames++; float[] fg = RenderState.getColor(0.8f); float[] bg = RenderState.getColor(0.3f); Rendering.drawRectangle(0, 0, 16, 16, 1, 0, 0, 0, 0); Rendering.drawRectangle(0, 0, width, height, fg[0], fg[1], fg[2], 1.0f, 0f); Rendering.drawRectangle(2, 2, width - 4, height - 4, bg[0], bg[1], bg[2], 1.0f, 0f); // roughly ported from Glass Pane if (cursorPos < 0) { cursorPos = 0; } else if (cursorPos > content.length()) { cursorPos = content.length(); } String trimmedText = Fonts.trimStringToWidth(str.substring(viewPos), Fonts.base[1], width - 24); int trimmedLength = trimmedText.length(); if (cursorPos > viewPos + trimmedLength) { viewPos = cursorPos - trimmedLength; } else if (cursorPos < viewPos) { viewPos = cursorPos; } int len = Fonts.base[1].getWidth(trimmedText); int mod = (int) (len >= width - 16 ? len - (width - 16) : 0); if (viewPos == 0) { mod = 0; } if (focused) { Rendering.drawRectangle( (8 - mod) + Fonts.base[1].getWidth( trimmedText.substring(0, Math.min(trimmedLength, Math.max(0, cursorPos - viewPos)))), 6, 2, height - 12, 1, 1, 1, (1.0f - ((frames % 25) / 40f)) / (Display.isActive() ? 1f : 4f), 0.2f); } GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glScissor((int) x + 8, Display.getHeight() - (int) (y + height), (int) width - 16, (int) height); Fonts.base[1].drawString(8 - mod, 1, trimmedText); GL11.glDisable(GL11.GL_SCISSOR_TEST); }
From source file:com.gameminers.mav.render.Rendering.java
License:Open Source License
public static void drawPolygon(float x, float y, float radius, float r, float g, float b, float a, int count, float z) { GL11.glPushMatrix();/*from ww w . j a va2 s. c om*/ GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glTranslatef(x, y, z); GL11.glColor4f(r, g, b, a); GL11.glBegin(GL11.GL_POLYGON); for (int i = 0; i < count; ++i) { GL11.glVertex2d(Math.sin(i / ((double) count) * 2 * Math.PI) * (radius), Math.cos(i / ((double) count) * 2 * Math.PI) * (radius)); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }
From source file:com.gameminers.mav.render.Rendering.java
License:Open Source License
public static void drawTriangle(float x, float y, float radius, float r, float g, float b, float a, float z) { GL11.glPushMatrix();/*from www . j av a 2 s . com*/ GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glTranslatef(x, y, z); GL11.glColor4f(r, g, b, a); GL11.glBegin(GL11.GL_TRIANGLES); for (int i = 0; i < 3; ++i) { GL11.glVertex2d(Math.sin(i / ((double) 3) * 2 * Math.PI) * (radius), Math.cos(i / 3D * 2 * Math.PI) * (radius)); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }