List of usage examples for org.lwjgl.opengl GL11 glColor3d
public static native void glColor3d(@NativeType("GLdouble") double red, @NativeType("GLdouble") double green, @NativeType("GLdouble") double blue);
From source file:com.lukke100.sbdi.Draw.java
License:Open Source License
static public void drawHollowCircle(double xCoord, double yCoord, double radius, int segments) { GL11.glColor3d(red, green, blue); double theta = (2 * Math.PI) / segments; double c = Math.cos(theta); double s = Math.sin(theta); double t;/* www.j a v a 2s . c o m*/ double x = radius; // start at angle = 0 double y = 0; GL11.glBegin(GL11.GL_LINE_LOOP); for (int ii = 0; ii < segments; ii++) { GL11.glVertex2d(x + xCoord, y + yCoord); // output vertex // apply the rotation matrix t = x; x = c * x - s * y; y = s * t + c * y; } GL11.glEnd(); }
From source file:com.lukke100.sbdi.Draw.java
License:Open Source License
static public void drawHollowRectangle(double xCoord, double yCoord, double width, double height) { GL11.glColor3d(red, green, blue); width--;/* w ww . j ava 2 s .com*/ height--; GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex2d(xCoord, yCoord); GL11.glVertex2d(xCoord + width, yCoord); GL11.glVertex2d(xCoord + width, yCoord + height); GL11.glVertex2d(xCoord, yCoord + height); GL11.glEnd(); }
From source file:com.lukke100.sbdi.Draw.java
License:Open Source License
static public void drawHollowSquare(double xCoord, double yCoord, double size) { GL11.glColor3d(red, green, blue); size--;/*w ww .ja v a 2 s . com*/ GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex2d(xCoord, yCoord); GL11.glVertex2d(xCoord + size, yCoord); GL11.glVertex2d(xCoord + size, yCoord + size); GL11.glVertex2d(xCoord, yCoord + size); GL11.glEnd(); }
From source file:com.lukke100.sbdi.Draw.java
License:Open Source License
static public void drawRectangle(double xCoord, double yCoord, double width, double height) { GL11.glColor3d(red, green, blue); GL11.glBegin(GL11.GL_QUADS);//from w ww .j a va 2s .co m GL11.glVertex2d(xCoord, yCoord); GL11.glVertex2d(xCoord + width, yCoord); GL11.glVertex2d(xCoord + width, yCoord + height); GL11.glVertex2d(xCoord, yCoord + height); GL11.glEnd(); }
From source file:com.lukke100.sbdi.Draw.java
License:Open Source License
static public void drawSquare(double xCoord, double yCoord, double size) { GL11.glColor3d(red, green, blue); GL11.glBegin(GL11.GL_QUADS);/* www.j a va 2 s. c o m*/ GL11.glVertex2d(xCoord, yCoord); GL11.glVertex2d(xCoord + size, yCoord); GL11.glVertex2d(xCoord + size, yCoord + size); GL11.glVertex2d(xCoord, yCoord + size); GL11.glEnd(); }
From source file:fr.ign.cogit.geoxygene.appli.render.primitive.LinePrimitiveRenderer.java
License:Open Source License
/** * Render simple line.// w ww .j a v a 2 s .c om * @param primitive primitive to paint */ private void renderLineDebug(final ParameterizedPolyline line) { if (line.getPointCount() < 2) { logger.warn("Line has " + line.getPointCount() + " points and cannot be rendered"); return; } final double epsilon = 1E-1; /** * p1 is the nth point, n1 the segment normal at p1 point * p2 is the (n+1)th point, n2 the segment normal at p2 point * * pXa, pXb are the */ Point2d p1 = line.getPoint(0); // nth point Point2d p2 = line.getPoint(1); // n+1 th point Point2d p3 = null; // n+2 th point Vector2d v1 = MathUtil.vector(p1, p2); // line direction at p1 Vector2d v2 = null; // line direction at p2 Vector2d n1 = MathUtil.computeNormal(v1); // line normal at p1 (perpendicular to segment direction) Vector2d n2 = null; // line normal at p2 (perpendicular to segment direction) Point2d p1a = MathUtil.pointOfLine(p1, n1, -this.getLineWidth() / 2); // first stretched point at p1 (p1 + lineWidth/2 * n1) Point2d p1b = MathUtil.pointOfLine(p1, n1, this.getLineWidth() / 2); // second stretched point at p1 (p1 - lineWidth/2 * n1) Point2d p2a = null; // first stretched point at p2 (p2 + lineWidth/2 * n2) Point2d p2b = null; // second stretched point at p2 (p2 - lineWidth/2 * n2) if (line.getPointCount() <= 2) { p3 = p2; n2 = n1; } double s = 1; GL11.glLineWidth(2.f); GL11.glBegin(GL11.GL_LINES); // first point GL11.glColor3d(1, 0, 0); GL11.glVertex2d(p1a.x, p1a.y); GL11.glVertex2d(p1b.x, p1b.y); try { for (int nPoint = 0; nPoint < line.getPointCount() - 2; nPoint++) { p3 = line.getPoint(nPoint + 2); v2 = MathUtil.vector(p2, p3); n2 = MathUtil.computeNormal(v2); p2a = MathUtil.pointOfLine(p2, n2, -this.getLineWidth() / 2); p2b = MathUtil.pointOfLine(p2, n2, this.getLineWidth() / 2); GL11.glColor3d(.5, .5, .5); GL11.glVertex2d(p1a.x, p1a.y); GL11.glVertex2d(p1b.x, p1b.y); /* GL11.glColor3d(.5, .5, .5); GL11.glVertex2d(p1.x, p1.y); GL11.glVertex2d(p1.x + s * v1.x, p1.y + s * v1.y); GL11.glColor3d(.5, .5, .5); GL11.glVertex2d(p1.x, p1.y); GL11.glVertex2d(p1.x + s * n1.x, p1.y + s * n1.y); */ Point2d Ia = MathUtil.intersectionPoint(p1a, v1, p2a, v2, epsilon); Point2d Ib = MathUtil.intersectionPoint(p1b, v1, p2b, v2, epsilon); // debug if (first && Ia != null && Ib != null && MathUtil.norm(MathUtil.vector(Ia, Ib)) > 100) { first = false; JDialog dialog = new JDialog(); GraphPanel graphPanel = new GraphPanel(); dialog.getContentPane().add(graphPanel); dialog.pack(); dialog.setVisible(true); graphPanel.addPoint("p1", p1); graphPanel.addPoint("p2", p2); graphPanel.addPoint("p3", p3); // graphPanel.addVector("n1", p1, n1); // graphPanel.addVector("n2", p2, n2); graphPanel.addVector("v1", p1, v1); graphPanel.addVector("v2", p1, v2); graphPanel.addVector(".", p1a, v1); graphPanel.addVector(",", p1b, v1); graphPanel.addVector("`", p2a, v2); graphPanel.addVector("'", p2b, v2); graphPanel.addPoint("p1a", p1a); graphPanel.addPoint("p1b", p1b); graphPanel.addPoint("p2a", p2a); graphPanel.addPoint("p2b", p2b); System.out.println("v1.v2 = " + MathUtil.cross(v1, v2)); // graphPanel.addPoint("Ia", Ia); // graphPanel.addPoint("Ib", Ib); System.out.println(nPoint + " on " + line.getPointCount() + " =>"); System.out.println(" p1 = " + p1); System.out.println(" p2 = " + p2); System.out.println(" p3 = " + p3); System.out.println(" n1 = " + n1); System.out.println(" n2 = " + n2); System.out.println(" v1 = " + v1); System.out.println(" v2 = " + v2); System.out.println(" p1a = " + p1a); System.out.println(" p1b = " + p1b); System.out.println(" p2a = " + p2a); System.out.println(" p2b = " + p2b); System.out.println(" Ia = " + Ia); System.out.println(" Ib = " + Ib); p3 = line.getPoint(nPoint + 2); v2 = MathUtil.vector(p2, p3); n2 = MathUtil.computeNormal(v2); p2a = MathUtil.pointOfLine(p2, n2, -this.getLineWidth() / 2); p2b = MathUtil.pointOfLine(p2, n2, this.getLineWidth() / 2); Ia = MathUtil.intersectionPoint(p1a, v1, p2a, v2, epsilon); Ib = MathUtil.intersectionPoint(p1b, v1, p2b, v2, epsilon); } if (Ia == null || Ib == null) { Ia = MathUtil.mean(p1a, p2a); Ib = MathUtil.mean(p1b, p2b); } // if no intersection, use p2a & p2b if (Ia == null) { GL11.glColor3d(.5, .5, .5); GL11.glVertex2d(p2a.x, p2b.y); } else { GL11.glColor3d(0, 0, 1); GL11.glVertex2d(Ia.x, Ia.y); } if (Ib == null) { GL11.glColor3d(.5, .5, .5); GL11.glVertex2d(p2b.x, p2b.y); } else { GL11.glColor3d(0, 1, 0); GL11.glVertex2d(Ib.x, Ib.y); } // shift context to the next point p1 = p2; n1 = n2; v1 = v2; p1a = p2a; p1b = p2b; p2 = p3; } if (p3 == null || n2 == null) { System.err.println("p3 = " + p3 + " n2 = " + n2 + " nbpt = " + line.getPointCount()); } // draw the last point Point2d p3a = MathUtil.pointOfLine(p3, n2, -this.getLineWidth() / 2); Point2d p3b = MathUtil.pointOfLine(p3, n2, this.getLineWidth() / 2); GL11.glColor3d(1, 1, 0); GL11.glVertex2d(p3a.x, p3a.y); GL11.glVertex2d(p3b.x, p3b.y); } finally { GL11.glEnd(); } }
From source file:fr.mcnanotech.kevin_68.nanotechmod.main.client.renderer.items.ItemLightSaberRender.java
License:Creative Commons License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { int red = (item.hasTagCompound() && item.getTagCompound().hasKey("red")) ? item.getTagCompound().getInteger("red") : 0;//from www . j av a 2 s .co m int green = (item.hasTagCompound() && item.getTagCompound().hasKey("green")) ? item.getTagCompound().getInteger("green") : 0; int blue = (item.hasTagCompound() && item.getTagCompound().hasKey("blue")) ? item.getTagCompound().getInteger("blue") : 0; switch (type) { case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glRotatef(-140, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.65F, -1.35F, 0.0F); model.render(0.0625F, item, false); GL11.glColor3d((float) (red) / 255.0F, (float) (green) / 255.0F, (float) (blue) / 255.0F); model.render(0.0625F, item, true); GL11.glPopMatrix(); break; } case EQUIPPED_FIRST_PERSON: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glRotatef(-140, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.65F, -1.35F, 0.0F); model.render(0.0625F, item, false); GL11.glColor3d((float) (red) / 255.0F, (float) (green) / 255.0F, (float) (blue) / 255.0F); model.render(0.0625F, item, true); GL11.glPopMatrix(); break; } case ENTITY: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glRotatef(0, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.4F, 0.2F, 0.0F); GL11.glScalef(2.0F, 2.0F, 2.0F); if (RenderItem.renderInFrame) { GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(-1.1F, -0.5F, 0.1F); GL11.glRotatef(-45.0F, 0.0F, 0.0F, 1.0F); } model.render(0.0625F, item, false); GL11.glColor3d((float) (red) / 255.0F, (float) (green) / 255.0F, (float) (blue) / 255.0F); model.render(0.0625F, item, true); GL11.glPopMatrix(); break; } case INVENTORY: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glRotatef(45.F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(11.5F, -16.0F, 0.0F); GL11.glScalef(17F, 17F, 17F); model.render(0.0625F, item, false); GL11.glColor3d((float) (red) / 255.0F, (float) (green) / 255.0F, (float) (blue) / 255.0F); model.render(0.0625F, item, true); GL11.glPopMatrix(); break; } default: break; } }
From source file:game.entities.Wall.java
License:Open Source License
@Override public void render(Render render) { GL11.glColor3d(0.5, 0.1, 0.8); render.drawLine(this.position, this.posMax); }
From source file:io.flob.blackheart.Button.java
License:Open Source License
private void render() { if (!active) { GL11.glColor3d(0.25f, 0.25f, 0.25f); } else if (selected()) { GL11.glColor3d(0.75f, 0.75f, 0.75f); }/*from w w w.j a v a2 s . c o m*/ GL11.glTexCoord2f(_texture.getU(), _texture.getV()); GL11.glVertex2f(position.getX(), position.getY()); GL11.glTexCoord2f(_texture.getU2(), _texture.getV()); GL11.glVertex2f(position.getX() + (size.getX()), position.getY()); GL11.glTexCoord2f(_texture.getU2(), _texture.getV2()); GL11.glVertex2f(position.getX() + (size.getX()), position.getY() + (size.getY())); GL11.glTexCoord2f(_texture.getU(), _texture.getV2()); GL11.glVertex2f(position.getX(), position.getY() + (size.getY())); GL11.glColor3d(1, 1, 1); }
From source file:io.flob.blackheart.CollisionBox.java
License:Open Source License
public void render() { GL11.glColor3d(1, 0, 1); GL11.glBegin(GL11.GL_LINE_STRIP);/* w ww .j a va2 s . co m*/ GL11.glVertex3f(position_minimum().getX(), position_minimum().getY(), position_minimum().getZ()); GL11.glVertex3f(position_maximum().getX(), position_minimum().getY(), position_minimum().getZ()); GL11.glVertex3f(position_maximum().getX(), position_maximum().getY(), position_minimum().getZ()); GL11.glVertex3f(position_minimum().getX(), position_maximum().getY(), position_minimum().getZ()); GL11.glVertex3f(position_minimum().getX(), position_minimum().getY(), position_minimum().getZ()); GL11.glVertex3f(position_minimum().getX(), position_minimum().getY(), position_maximum().getZ()); GL11.glVertex3f(position_maximum().getX(), position_minimum().getY(), position_maximum().getZ()); GL11.glVertex3f(position_maximum().getX(), position_maximum().getY(), position_maximum().getZ()); GL11.glVertex3f(position_minimum().getX(), position_maximum().getY(), position_maximum().getZ()); GL11.glVertex3f(position_minimum().getX(), position_minimum().getY(), position_maximum().getZ()); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(position_maximum().getX(), position_minimum().getY(), position_minimum().getZ()); GL11.glVertex3f(position_maximum().getX(), position_minimum().getY(), position_maximum().getZ()); GL11.glVertex3f(position_maximum().getX(), position_maximum().getY(), position_minimum().getZ()); GL11.glVertex3f(position_maximum().getX(), position_maximum().getY(), position_maximum().getZ()); GL11.glVertex3f(position_minimum().getX(), position_maximum().getY(), position_minimum().getZ()); GL11.glVertex3f(position_minimum().getX(), position_maximum().getY(), position_maximum().getZ()); GL11.glEnd(); GL11.glColor3d(1, 1, 1); }