List of usage examples for org.lwjgl.opengl GL11 glColor3f
public static native void glColor3f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green, @NativeType("GLfloat") float blue);
From source file:minecraft.phoenix.cityscape.space.util.SkyRendererUtil.java
License:LGPL
@Override @SideOnly(Side.CLIENT)//from www.j a va 2s. co m public void render(float partialTicks, WorldClient world, Minecraft mc) { if (!once) { this.starGLCallList = GLAllocation.generateDisplayLists(3); GL11.glPushMatrix(); GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE); SkyRendererUtil.renderStars().draw(); GL11.glEndList(); GL11.glPopMatrix(); Tessellator var5 = Tessellator.instance; this.glSkyList = this.starGLCallList + 1; GL11.glNewList(this.glSkyList, GL11.GL_COMPILE); byte var7 = 64; int var8 = 256 / var7 + 2; float var6 = 16.0F; int var9; int var10; for (var9 = -var7 * var8; var9 <= var7 * var8; var9 += var7) { for (var10 = -var7 * var8; var10 <= var7 * var8; var10 += var7) { var5.startDrawingQuads(); var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + 0)); var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + 0)); var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + var7)); var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + var7)); var5.draw(); } } GL11.glEndList(); this.glSkyList2 = this.starGLCallList + 2; GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE); var6 = -16.0F; var5.startDrawingQuads(); for (var9 = -var7 * var8; var9 <= var7 * var8; var9 += var7) { for (var10 = -var7 * var8; var10 <= var7 * var8; var10 += var7) { var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + 0)); var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + 0)); var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + var7)); var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + var7)); } } var5.draw(); GL11.glEndList(); } GL11.glDisable(GL11.GL_TEXTURE_2D); float var3 = 0.0F; float var4 = 0.0F; float var5 = 0.0F; GL11.glColor3f(var3, var4, var5); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); GL11.glColor3f(var3, var4, var5); GL11.glCallList(this.glSkyList); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.disableStandardItemLighting(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); float var9 = 0.0F; float var10 = 0.0F; float var11 = 0.0F; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef(var9, var10, var11); GL11.glDisable(GL11.GL_TEXTURE_2D); float var20 = world.getStarBrightness(partialTicks); GL11.glColor4f(var20, var20, var20, var20); GL11.glCallList(this.starGLCallList); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_FOG); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 100.0F, 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); }
From source file:model.Axis.java
@Override public void render() { GL11.glBegin(GL11.GL_LINES);// www . j a v a 2s . c o m GL11.glColor3f(1, 0, 0); GL11.glVertex3f(0, 0, 0); GL11.glVertex3f(length, 0, 0); GL11.glColor3f(0, 1, 0); GL11.glVertex3f(0, 0, 0); GL11.glVertex3f(0, length, 0); GL11.glColor3f(0, 0, 1); GL11.glVertex3f(0, 0, 0); GL11.glVertex3f(0, 0, length); GL11.glEnd(); }
From source file:model.Connector.java
License:Open Source License
public void draw() { GL11.glBegin(GL11.GL_LINES);/*from ww w . ja v a 2 s . co m*/ GL11.glColor3f(1.0f, 0, 0); GL11.glVertex3f(pos.x, pos.y, pos.z); GL11.glVertex3f(pos.x + axis.x / 5.0f, pos.y + axis.y / 5.0f, pos.z + axis.z / 5.0f); GL11.glEnd(); }
From source file:model.Quad.java
@Override public void render() { GL11.glBegin(GL11.GL_QUADS);/*from w ww .java2 s . c o m*/ GL11.glColor3f(0.5f, 0.5f, 1.0f); GL11.glVertex2f(center.x - 50, center.y - 50); GL11.glVertex2f(center.x - 50, center.y + 50); GL11.glVertex2f(center.x + 50, center.y + 50); GL11.glVertex2f(center.x + 50, center.y - 50); GL11.glEnd(); }
From source file:mods.railcraft.client.render.RenderPneumaticEngine.java
License:Open Source License
private void render(EnergyStage energy, float progress, ForgeDirection orientation, double x, double y, double z) { GL11.glPushMatrix();/* w w w . jav a 2 s .c o m*/ GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor3f(1, 1, 1); GL11.glTranslatef((float) x, (float) y, (float) z); float[] angle = { 0, 0, 0 }; float[] translate = { orientation.offsetX, orientation.offsetY, orientation.offsetZ }; switch (orientation) { case EAST: case WEST: case DOWN: angle[2] = angleMap[orientation.ordinal()]; break; case SOUTH: case NORTH: angle[0] = angleMap[orientation.ordinal()]; break; } base.setRotation(angle[0], angle[1], angle[2]); trunk.rotate(angle[0], angle[1], angle[2]); frame.setRotation(angle[0], angle[1], angle[2]); piston.setRotation(angle[0], angle[1], angle[2]); float factor = (float) (1.0 / 16.0); bindTexture(texture); trunk.render(energy, factor); base.render(factor); float step; if (progress > 0.5) { step = 7.99F - (progress - 0.5F) * 2F * 7.99F; } else { step = progress * 2F * 7.99F; } float frameTrans = step / 16; GL11.glTranslatef(translate[0] * frameTrans, translate[1] * frameTrans, translate[2] * frameTrans); frame.render(factor); GL11.glTranslatef(-translate[0] * frameTrans, -translate[1] * frameTrans, -translate[2] * frameTrans); float pistonPrep = 0.01f; GL11.glTranslatef(-translate[0] * pistonPrep, -translate[1] * pistonPrep, -translate[2] * pistonPrep); float pistonTrans = 2F / 16F; GL11.glDisable(GL11.GL_LIGHTING); for (int i = 0; i <= step + 2; i += 2) { piston.render(factor); GL11.glTranslatef(translate[0] * pistonTrans, translate[1] * pistonTrans, translate[2] * pistonTrans); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.RenderTESRSignals.java
License:Open Source License
private void renderPairs(TileEntity tile, double x, double y, double z, float f, AbstractPair pair, ColorProfile colorProfile) {/* w ww . jav a 2s. c o m*/ if (pair.getPairs().isEmpty()) { return; } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glLineWidth(5F); GL11.glBegin(GL11.GL_LINES); for (WorldCoordinate target : pair.getPairs()) { int color = colorProfile.getColor(tile, pair.getCoords(), target); float c1 = (float) (color >> 16 & 255) / 255.0F; float c2 = (float) (color >> 8 & 255) / 255.0F; float c3 = (float) (color & 255) / 255.0F; GL11.glColor3f(c1, c2, c3); GL11.glVertex3f((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f); float tx = (float) x + target.x - tile.xCoord; float ty = (float) y + target.y - tile.yCoord; float tz = (float) z + target.z - tile.zCoord; GL11.glVertex3f(tx + 0.5f, ty + 0.5f, tz + 0.5f); } GL11.glEnd(); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:mods.railcraft.client.render.RenderTrackBuffer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float time) { if (tile instanceof TileTrack) { if (((TileTrack) tile).getTrackInstance() instanceof TrackBufferStop) { TrackBufferStop track = (TrackBufferStop) ((TileTrack) tile).getTrackInstance(); GL11.glPushMatrix();// w ww .j ava2 s. co m GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor3f(1, 1, 1); GL11.glTranslatef((float) x, (float) y, (float) z); model.resetRotation(); int meta = tile.getBlockMetadata(); if (meta == 1) { model.rotateY((float) (Math.PI / 2.0)); } if (meta == 0 != track.isReversed()) { model.rotateY((float) Math.PI); } bindTexture(TEXTURE); model.render(1f / 16f); GL11.glPopAttrib(); GL11.glPopMatrix(); } } }
From source file:mss.util.Planet.java
License:Open Source License
public void draw2D(boolean debug) { GL11.glBegin(GL11.GL_POLYGON);//w w w. ja v a2 s . c om GL11.glColor3f((float) (this.color.getRed() / 255.0), (float) (this.color.getGreen() / 255.0), (float) (this.color.getBlue() / 255.0)); for (double angle = 0; angle <= 360; angle += 1) { GL11.glVertex2d(this.coords.getX() + Math.sin(angle) * this.radix, this.coords.getY() + Math.cos(angle) * this.radix); } GL11.glEnd(); if (debug) { GL11.glBegin(GL11.GL_LINES); GL11.glColor3f((float) ((256 - this.color.getRed()) / 255.0), (float) ((256 - this.color.getGreen()) / 255.0), (float) ((256 - this.color.getBlue()) / 255.0)); GL11.glVertex2d(this.coords.getX(), this.coords.getY()); GL11.glVertex2d(this.coords.getX() + this.v.getX(), this.coords.getY() + this.v.getY()); GL11.glEnd(); } }
From source file:myfirstgame.grass.java
public void outline() { GL11.glLineWidth((float) 2.5); GL11.glColor3f(255, 0, 0); GL11.glBegin(GL11.GL_LINES);//from ww w. ja v a2 s . c o m GL11.glVertex2f(gx, gy); GL11.glVertex2f(gx, gy + sizeY); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(gx, gy + sizeY); GL11.glVertex2f(gx + sizeX, gy + sizeY); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(gx + sizeX, gy + sizeY); GL11.glVertex2f(gx + sizeX, gy); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(gx + sizeX, gy); GL11.glVertex2f(gx, gy); GL11.glEnd(); GL11.glColor3f(255, 255, 255); }
From source file:myfirstgame.Tree.java
public void outline() { GL11.glLineWidth((float) 2.5); GL11.glColor3f(255, 0, 0); GL11.glBegin(GL11.GL_LINES);/* www . j a v a 2s . c o m*/ GL11.glVertex2f(treex, treey); GL11.glVertex2f(treex, treey + sizeY); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(treex, treey + sizeY); GL11.glVertex2f(treex + sizeX, treey + sizeY); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(treex + sizeX, treey + sizeY); GL11.glVertex2f(treex + sizeX, treey); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(treex + sizeX, treey); GL11.glVertex2f(treex, treey); GL11.glEnd(); GL11.glColor3f(255, 255, 255); }