List of usage examples for org.lwjgl.opengl GL11 glColor4d
public static native void glColor4d(@NativeType("GLdouble") double red, @NativeType("GLdouble") double green, @NativeType("GLdouble") double blue, @NativeType("GLdouble") double alpha);
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;/*w w w . j a v a 2 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.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;/*w w w. j a va 2 s . 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.electromaster.client.effect.CurrentChargingHUD.java
License:GNU General Public License
@Override public void draw(ScaledResolution sr) { double width = sr.getScaledWidth_double(), height = sr.getScaledHeight_double(); GL11.glDisable(GL11.GL_ALPHA_TEST);/* w w w . j a v a 2s .c o m*/ arcHandler.xScale = width / 2; arcHandler.yScale = height / 2; double mAlpha; if (isBlendingOut()) { mAlpha = 1 - (double) (GameTimer.getTime() - blendTime) / BLEND_OUT_TIME; if (mAlpha < 0) mAlpha = 0; } else { mAlpha = Math.min((double) this.getTimeActive() / BLEND_TIME, 1.0); } /* Black Mask */ { GL11.glColor4d(0, 0, 0, 0.1 * mAlpha); HudUtils.colorRect(0, 0, width, height); GL11.glColor4d(1, 1, 1, 1); } /* Blue Mask */ { GL11.glColor4d(1, 1, 1, 1 * mAlpha); RenderUtils.loadTexture(mask); HudUtils.rect(0, 0, width, height); } /* SubArc */ { GL11.glColor4d(1, 1, 1, isBlendingOut() ? 0.4 : 0.3); GL11.glPushMatrix(); GL11.glTranslated(width / 2, height / 2, 0); arcHandler.drawAll(); GL11.glPopMatrix(); } if (isBlendingOut() && GameTimer.getTime() - blendTime > 1000) dispose(); }
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 a v a2s . 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.lambdalib.cgui.gui.CGui.java
License:MIT License
private void drawTraverse(double mx, double my, Widget cur, WidgetContainer set, Widget top) { try {/*from ww w.j a va 2 s . c om*/ if (cur != null && cur.isVisible()) { GL11.glPushMatrix(); GL11.glTranslated(cur.x, cur.y, 0); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glScaled(cur.scale, cur.scale, 1); GL11.glTranslated(-cur.transform.pivotX, -cur.transform.pivotY, 0); GL11.glColor4d(1, 1, 1, 1); //Force restore color for any widget cur.post(new FrameEvent((mx - cur.x) / cur.scale, (my - cur.y) / cur.scale, cur == top)); GL11.glPopMatrix(); } } catch (Exception e) { LambdaLib.log.error("Error occured handling widget draw. instance class: " + cur.getClass().getName() + ", name: " + cur.getName()); e.printStackTrace(); } if (cur == null || cur.isVisible()) { Iterator<Widget> iter = set.iterator(); while (iter.hasNext()) { Widget wn = iter.next(); drawTraverse(mx, my, wn, wn, top); } } }
From source file:cn.lambdalib.multiblock.RenderBlockMultiModel.java
License:MIT License
@Override public void drawAtOrigin(TileEntity te) { GL11.glColor4d(1, 1, 1, 1); if (tex != null) { RenderUtils.loadTexture(tex);/*w w w . j av a 2 s.co m*/ } GL11.glRotated(rotateY, 0, 1, 0); GL11.glScaled(scale, scale, scale); mdl.render(te, 0, 0); }
From source file:cn.lambdalib.util.client.RenderUtils.java
License:MIT License
public static void drawBlackout() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glDisable(GL11.GL_CULL_FACE);// w w w .j a v a 2 s . c o m GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glLoadIdentity(); GLU.gluOrtho2D(1, 0, 1, 0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glColor4d(0, 0, 0, 0.7); GL11.glTranslated(0, 0, 0); HudUtils.colorRect(0, 0, 1, 1); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glColor4d(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:cn.lambdalib.util.helper.Color.java
License:MIT License
@SideOnly(Side.CLIENT) public void bind() { GL11.glColor4d(r, g, b, a); }
From source file:cn.liutils.api.gui.LIGui.java
License:Open Source License
private void drawTraverse(double mx, double my, WidgetNode cur, Iterable<WidgetNode> set, WidgetNode top) { if (cur != null && cur.widget.doesDraw) { GL11.glPushMatrix();/*from ww w . j a v a2 s. c om*/ GL11.glTranslated(cur.x, cur.y, 0); GL11.glScaled(cur.scale, cur.scale, 1); //System.out.println(cur.widget + " " + DebugUtils.formatArray(cur.x, cur.y, cur.scale)); GL11.glColor4d(1, 1, 1, 1); //Force restore color for any widget cur.widget.draw((mx - cur.x) / cur.scale, (my - cur.y) / cur.scale, cur == top); GL11.glPopMatrix(); } if (cur == null || cur.widget.doesDraw) { if (cur != null) cur.iterating = true; Iterator<WidgetNode> iter = set.iterator(); while (iter.hasNext()) { WidgetNode wn = iter.next(); drawTraverse(mx, my, wn, wn, top); } if (cur != null) cur.iterating = false; } }
From source file:cn.liutils.api.gui.Widget.java
License:Open Source License
/** * Should be called at this widget's draw() function. *//* ww w. ja va 2 s . c om*/ protected void drawBlackout() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPushMatrix(); GL11.glLoadIdentity(); GLU.gluOrtho2D(1, 0, 1, 0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glColor4d(0, 0, 0, 0.6); HudUtils.setZLevel(-1); HudUtils.drawModalRect(0, 0, 1, 1); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); RenderUtils.bindIdentity(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glMatrixMode(GL11.GL_MODELVIEW); }