List of usage examples for org.lwjgl.opengl GL11 glEnable
public static void glEnable(@NativeType("GLenum") int target)
From source file:cn.academy.misc.client.render.RendererRayBase.java
License:Open Source License
@Override public final void doRender(Entity var1, double x, double y, double z, float h, float a) { long time = Minecraft.getSystemTime(); T er = (T) var1; if (!er.isLoaded()) { return;//from w ww. j a v a 2 s . c o m } er.beforeRender(); x = er.posX - RenderManager.renderPosX; y = er.posY - RenderManager.renderPosY; z = er.posZ - RenderManager.renderPosZ; EntityPlayer clientPlayer = Minecraft.getMinecraft().thePlayer; boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && clientPlayer.equals(er.getSpawner()); double len = er.getDisplayRayLen(); //System.out.println(firstPerson); if (er.doesFollowSpawner()) { //Pos injection, for better viewing effect x = 0; y = 0; z = 0; } GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); if (disableLight) GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); { GL11.glTranslated(x, y, z); GL11.glRotated(er.rotationYaw, 0, -1, 0); GL11.glRotated(er.rotationPitch, 1, 0, 0); GL11.glColor4d(1, 1, 1, alpha * er.getAlpha()); if (firstPerson) { if (er.isNearPlayer()) transformFirstPerson(er, x, y, z); } else { if (er.isNearPlayer()) transformThirdPerson(er, x, y, z); optimizeView(er, x, y, z); } if (disableLight) { OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); Tessellator.instance.setBrightness(15728880); } drawAtOrigin(er, len, firstPerson); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.academy.misc.client.render.RenderMarker.java
License:Open Source License
@Override public void doRender(Entity ent, double x, double y, double z, float a, float b) { EntityMarker marker = (EntityMarker) ent; Entity targ = marker.target;/*from ww w . ja va2 s . c o m*/ double width = targ.width, height = targ.height; Tessellator t = Tessellator.instance; if (targ != null) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glPushMatrix(); GL11.glTranslated(x - width / 2, y, z - width / 2); GL11.glColor4d(marker.r, marker.g, marker.b, marker.a); for (int i = 0; i < 8; ++i) { GL11.glPushMatrix(); boolean rev = i < 4; double sx = width * mulArray[i][0], sy = height * mulArray[i][1], sz = width * mulArray[i][2]; final double len = 0.2 * width; GL11.glTranslated(sx, sy, sz); GL11.glRotated(rotArray[i], 0, 1, 0); GL11.glColor4d(marker.r, marker.g, marker.b, marker.a); GL11.glLineWidth(3f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawing(GL11.GL_LINES); t.setBrightness(15728880); t.addVertex(0, 0, 0); t.addVertex(0, rev ? len : -len, 0); t.addVertex(0, 0, 0); t.addVertex(len, 0, 0); t.addVertex(0, 0, 0); t.addVertex(0, 0, len); t.draw(); GL11.glPushMatrix(); GL11.glScaled(0.1, 0.1, 0.1); //ACModels.MDL_SOLAR.renderAll(); GL11.glPopMatrix(); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); } }
From source file:cn.academy.support.nei.FusorRecipeHandler.java
License:GNU General Public License
@Override public void drawExtras(int recipe) { if (tick >= 50) tick = 0;//from w w w . j a v a 2 s . c om GL11.glEnable(GL11.GL_BLEND); Resources.font().draw(String.valueOf(((IFCachedRecipe) arecipes.get(recipe)).liquid), 75, 11.5f, new FontOption(13, new Color(0xFF373737))); ShaderMono.instance().useProgram(); GL11.glColor4f(55f / 151, 55f / 151, 55f / 151, 1); RenderUtils.loadTexture(new ResourceLocation("academy:textures/guis/progress/progress_fusor.png")); HudUtils.rect(62, 40.5f, 0, 0, 40d * (tick / 50d), 10, 126 * (tick / 50d), 30); GL20.glUseProgram(0); }
From source file:cn.academy.support.nei.MetalFormerRecipeHandler.java
License:GNU General Public License
@Override public void drawExtras(int recipe) { if (tick >= 50) tick = 0;/* www . ja v a2s. c o m*/ ShaderMono.instance().useProgram(); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(55f / 151, 55f / 151, 55f / 151, 1); RenderUtils.loadTexture(((MFCachedRecipe) arecipes.get(recipe)).mode.texture); HudUtils.rect(73, 23, 0, 0, 18, 18, 48, 48); RenderUtils.loadTexture(new ResourceLocation("academy:textures/guis/progress/progress_metalformer.png")); HudUtils.rect(57, 41, 0, 0, 50d * (tick / 50d), 13, 114d * (tick / 50d), 30); GL20.glUseProgram(0); }
From source file:cn.academy.terminal.client.TerminalInstallerRenderer.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glDisable(GL11.GL_CULL_FACE);// w ww . ja v a2s .co m super.renderItem(type, item, data); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.academy.terminal.client.TerminalUI.java
License:GNU General Public License
@Override public void draw(ScaledResolution sr) { //Frame update selection = (int) ((mouseY - 0.01) / MAX_MY * 3) * 3 + (int) ((mouseX - 0.01) / MAX_MX * 3); if (mouseY == 0) { mouseY = 1;/*from w w w.j a v a 2s .c o m*/ if (scroll > 0) scroll--; } if (mouseY == MAX_MY) { mouseY -= 1; if (scroll < getMaxScroll()) scroll++; } //Draw Minecraft mc = Minecraft.getMinecraft(); long time = GameTimer.getTime(); if (lastFrameTime == 0) lastFrameTime = time; long dt = time - lastFrameTime; mouseX += helper.dx * SENSITIVITY; mouseY -= helper.dy * SENSITIVITY; mouseX = Math.max(0, Math.min(MAX_MX, mouseX)); mouseY = Math.max(0, Math.min(MAX_MY, mouseY)); buffX = balance(dt, buffX, mouseX); buffY = balance(dt, buffY, mouseY); helper.dx = helper.dy = 0; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); float aspect = (float) mc.displayWidth / mc.displayHeight; GLU.gluPerspective(50, aspect, 1f, 100); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4d(1, 1, 1, 1); double scale = 1.0 / 310; GL11.glTranslated(.35 * aspect, 1.2, -4); GL11.glTranslated(1, -1.8, 0); GL11.glRotated(-1.6, 0, 0, 1); GL11.glRotated(-18 - 4 * (buffX / MAX_MX - 0.5) + 1 * Math.sin(time / 1000.0), 0, 1, 0); GL11.glRotated(7 + 4 * (buffY / MAX_MY - 0.5), 1, 0, 0); //DEBUG CODE // GL11.glPointSize(20); // GL11.glColor4d(1, 1, 1, 1); // GL11.glDisable(GL11.GL_TEXTURE_2D); // GL11.glBegin(GL11.GL_POINTS); // GL11.glVertex3f(0, 0, 0); // GL11.glEnd(); // GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glTranslated(-1, 1.8, 0); GL11.glScaled(scale, -scale, scale); gui.draw(mouseX, mouseY); { GL11.glPushMatrix(); double csize = (getSelectedApp() == null ? 1 : 1.3) * (20 + Math.sin(time / 300.0) * 2); RenderUtils.loadTexture(CURSOR); GL11.glColor4d(1, 1, 1, .4); GL11.glTranslated(0, 0, -2); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); HudUtils.rect(-csize / 2 + buffX, -csize / 2 + buffY + 120, csize, csize); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glCullFace(GL11.GL_BACK); }
From source file:cn.academy.vanilla.generic.client.render.RippleMarkRender.java
License:GNU General Public License
@Override public void doRender(Entity entity, double x, double y, double z, float a, float b) { EntityRippleMark mark = (EntityRippleMark) entity; long dt = GameTimer.getTime() - mark.creationTime; GL11.glDisable(GL11.GL_CULL_FACE);//from w w w . ja va2 s . c o m GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0); GL11.glDepthMask(false); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); for (int i = 0; i < timeOffsets.length; ++i) { GL11.glPushMatrix(); long mod = (dt - timeOffsets[i]) % CYCLE; float size = getSize(mod); GL11.glTranslatef(0, getHeight(mod), 0); GL11.glScalef(size, 1, size); material.color = mark.color.copy(); material.color.a *= getAlpha(mod); mesh.draw(material); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_DEPTH_TEST); }
From source file:cn.academy.vanilla.meltdowner.client.render.RenderMdShield.java
License:GNU General Public License
@Override public void doRender(Entity _entity, double x, double y, double z, float a, float b) { if (RenderUtils.isInShadowPass()) { return;//from w ww .j a v a 2 s . co m } long time = GameTimer.getTime(); EntityMdShield entity = (EntityMdShield) _entity; // Calculate rotation long dt; if (entity.lastRender == 0) dt = 0; else dt = time - entity.lastRender; float rotationSpeed = MathUtils.lerpf(0.8f, 2f, Math.min(entity.ticksExisted / 30.0f, 1f)); entity.rotation += rotationSpeed * dt; if (entity.rotation >= 360f) entity.rotation -= 360f; ShaderSimple.instance().useProgram(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glAlphaFunc(GL11.GL_GREATER, 0.05f); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); GL11.glRotatef(-entity.rotationYaw, 0, 1, 0); GL11.glRotatef(entity.rotationPitch, 1, 0, 0); GL11.glRotatef(entity.rotation, 0, 0, 1); float size = EntityMdShield.SIZE * MathUtils.lerpf(0.2f, 1f, Math.min(entity.ticksExisted / 15.0f, 1f)); float alpha = Math.min(entity.ticksExisted / 6.0f, 1.0f); GL11.glScalef(size, size, 1); RenderUtils.loadTexture(texture); mesh.draw(ShaderSimple.instance()); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f); GL20.glUseProgram(0); entity.lastRender = time; }
From source file:cn.academy.vanilla.teleporter.client.MarkRender.java
License:GNU General Public License
@Override public void doRender(Entity ent, double x, double y, double z, float var8, float var9) { if (RenderUtils.isInShadowPass()) return;/*from w w w. j av a2 s . co m*/ EntityTPMarking mark = (EntityTPMarking) ent; if (!mark.firstUpdated()) return; int texID = (int) ((mark.ticksExisted / 2.5) % tex.length); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); { GL11.glTranslated(x, y, z); GL11.glRotated(-mark.rotationYaw, 0, 1, 0); GL11.glScaled(-1, -1, 1); ShaderSimple.instance().useProgram(); RenderUtils.loadTexture(tex[texID]); if (!mark.available) { GL11.glColor4d(1, 0.2, 0.2, 1); } else { GL11.glColor4d(1, 1, 1, 1); } model.draw(); GL20.glUseProgram(0); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.academy.vanilla.teleporter.client.RenderMarker.java
License:GNU General Public License
@Override public void doRender(Entity ent, double x, double y, double z, float a, float b) { EntityMarker marker = (EntityMarker) ent; if (!marker.firstUpdated()) return;/* w w w . j av a2s . co m*/ Entity targ = marker.target; float width, height; if (targ != null) { width = targ.width; height = targ.height; } else { width = marker.width; height = marker.height; } ShaderNotex.instance().useProgram(); GL11.glDisable(GL11.GL_TEXTURE_2D); if (marker.ignoreDepth) GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glTranslated(x - width / 2, y + 0.05 * Math.sin(GameTimer.getAbsTime() / 400.0), z - width / 2); marker.color.bind(); renderMark(width, height); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_DEPTH_TEST); GL20.glUseProgram(0); }