List of usage examples for org.lwjgl.opengl GL11 glColor4f
public static native void glColor4f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green, @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha);
From source file:com.fireball1725.firecore.client.gui.GuiBase.java
License:Open Source License
protected final void drawGuiContainerForegroundLayer(int x, int y) { int ox = this.guiLeft; int oy = this.guiTop; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); drawFG(ox, oy, x, y);/* w w w.j a v a2 s. c o m*/ }
From source file:com.frozencode.microconnections.client.interfaces.GUIMCIBench.java
@Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1, 1, 1, 1); Minecraft.getMinecraft().getTextureManager().bindTexture(textures); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); }
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 w w w . j a v a2 s. c o m*/ 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 w ww . j a va 2 s. co m 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(); }
From source file:com.gameminers.mav.render.Rendering.java
License:Open Source License
public static void drawRectangle(float x, float y, float width, float height, float r, float g, float b, float a, float z) { GL11.glPushMatrix();/*from ww w. j a v a 2 s . c o m*/ GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glTranslatef(0, 0, z); GL11.glColor4f(r, g, b, a); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(x, y); GL11.glVertex2f(x + width, y); GL11.glVertex2f(x + width, y + height); GL11.glVertex2f(x, y + height); GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }
From source file:com.github.begla.blockmania.game.mobs.GelatinousCube.java
License:Apache License
private void generateDisplayList() { _displayListOuterBody = glGenLists(1); _displayListInnerBody = glGenLists(1); glNewList(_displayListOuterBody, GL_COMPILE); glBegin(GL_QUADS);// ww w . j a v a 2 s . c om GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.8f); // TOP GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); // LEFT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); // BACK GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); // RIGHT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); GL11.glColor4f(0.8f, 0.8f, 0.8f, 0.8f); // FRONT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); // BOTTOM GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glEnd(); GL11.glEndList(); glNewList(_displayListInnerBody, GL_COMPILE); glBegin(GL_QUADS); GL11.glColor4f(0.8f, 0.8f, 0.8f, 1.0f); // TOP GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); // LEFT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); // BACK GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); // RIGHT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glColor4f(0.6f, 0.6f, 0.6f, 1.0f); // FRONT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); // BOTTOM GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glEnd(); GL11.glEndList(); }
From source file:com.github.begla.blockmania.rendering.helper.Primitives.java
License:Apache License
public static int generateColoredBlock(Vector4f color, float size) { int id = glGenLists(1); GL11.glNewList(id, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_QUADS);// w w w.j a va 2s . c o m GL11.glColor4f(color.x, color.y, color.z, color.w); float sHalf = size / 2; // TOP GL11.glVertex3f(-sHalf, sHalf, sHalf); GL11.glVertex3f(sHalf, sHalf, sHalf); GL11.glVertex3f(sHalf, sHalf, -sHalf); GL11.glVertex3f(-sHalf, sHalf, -sHalf); // LEFT GL11.glVertex3f(-sHalf, -sHalf, -sHalf); GL11.glVertex3f(-sHalf, -sHalf, sHalf); GL11.glVertex3f(-sHalf, sHalf, sHalf); GL11.glVertex3f(-sHalf, sHalf, -sHalf); // RIGHT GL11.glVertex3f(sHalf, sHalf, -sHalf); GL11.glVertex3f(sHalf, sHalf, sHalf); GL11.glVertex3f(sHalf, -sHalf, sHalf); GL11.glVertex3f(sHalf, -sHalf, -sHalf); GL11.glColor4f(0.85f * color.x, 0.85f * color.y, 0.85f * color.z, color.w); // FRONT GL11.glVertex3f(-sHalf, sHalf, -sHalf); GL11.glVertex3f(sHalf, sHalf, -sHalf); GL11.glVertex3f(sHalf, -sHalf, -sHalf); GL11.glVertex3f(-sHalf, -sHalf, -sHalf); // BACK GL11.glVertex3f(-sHalf, -sHalf, sHalf); GL11.glVertex3f(sHalf, -sHalf, sHalf); GL11.glVertex3f(sHalf, sHalf, sHalf); GL11.glVertex3f(-sHalf, sHalf, sHalf); // BOTTOM GL11.glVertex3f(-sHalf, -sHalf, -sHalf); GL11.glVertex3f(sHalf, -sHalf, -sHalf); GL11.glVertex3f(sHalf, -sHalf, sHalf); GL11.glVertex3f(-sHalf, -sHalf, sHalf); GL11.glEnd(); GL11.glEndList(); return id; }
From source file:com.github.begla.blockmania.rendering.Primitives.java
License:Apache License
/** * @param scaleX Scale along the x-axis * @param scaleY Scale along the y-axis * @param scaleZ Scale along the z-axis * @param x Position on the x-axis * @param y Position on the y-axis * @param z Position on the z-axis * @param drawLeft/*from w w w. ja va2s . c o m*/ * @param drawRight * @param drawFront * @param drawBack */ public static void drawCloud(double scaleX, double scaleY, double scaleZ, double x, double y, double z, boolean drawLeft, boolean drawRight, boolean drawFront, boolean drawBack) { // Top Face GL11.glColor4f(CLOUD_COLOR_2.x, CLOUD_COLOR_2.y, CLOUD_COLOR_2.z, CLOUD_COLOR_2.w); GL11.glTexCoord2f(0.0f, 0.5f); GL11.glVertex3d(-0.5 * scaleX + x, 0.5 * scaleY + y, -0.5 * scaleZ + z); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3d(-0.5 * scaleX + x, 0.5 * scaleY + y, 0.5 * scaleZ + z); GL11.glTexCoord2f(0.5f, 0.0f); GL11.glVertex3d(0.5 * scaleX + x, 0.5 * scaleY + y, 0.5 * scaleZ + z); GL11.glTexCoord2f(0.5f, 0.5f); GL11.glVertex3d(0.5 * scaleX + x, 0.5 * scaleY + y, -0.5 * scaleZ + z); // Back Face if (drawBack) { GL11.glColor4f(CLOUD_COLOR_2.x, CLOUD_COLOR_2.y, CLOUD_COLOR_2.z, CLOUD_COLOR_2.w); GL11.glTexCoord2f(0.5f, 0.0f); GL11.glVertex3d(-0.5 * scaleX + x, -0.5 * scaleY + y, -0.5 * scaleZ + z); GL11.glTexCoord2f(0.5f, 0.5f); GL11.glVertex3d(-0.5 * scaleX + x, 0.5 * scaleY + y, -0.5 * scaleZ + z); GL11.glTexCoord2f(0.0f, 0.5f); GL11.glVertex3d(0.5 * scaleX + x, 0.5 * scaleY + y, -0.5 * scaleZ + z); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3d(0.5 * scaleX + x, -0.5 * scaleY + y, -0.5 * scaleZ + z); } // Left Face if (drawLeft) { GL11.glColor4f(CLOUD_COLOR_2.x, CLOUD_COLOR_2.y, CLOUD_COLOR_2.z, CLOUD_COLOR_2.w); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3d(-0.5 * scaleX + x, -0.5 * scaleY + y, -0.5 * scaleZ + z); GL11.glTexCoord2f(0.5f, 0.0f); GL11.glVertex3d(-0.5 * scaleX + x, -0.5 * scaleY + y, 0.5 * scaleZ + z); GL11.glTexCoord2f(0.5f, 0.5f); GL11.glVertex3d(-0.5 * scaleX + x, 0.5 * scaleY + y, 0.5 * scaleZ + z); GL11.glTexCoord2f(0.0f, 0.5f); GL11.glVertex3d(-0.5 * scaleX + x, 0.5 * scaleY + y, -0.5 * scaleZ + z); } // Right face if (drawRight) { GL11.glColor4f(CLOUD_COLOR_2.x, CLOUD_COLOR_2.y, CLOUD_COLOR_2.z, CLOUD_COLOR_2.w); GL11.glTexCoord2f(0.5f, 0.0f); GL11.glVertex3d(0.5 * scaleX + x, -0.5 * scaleY + y, -0.5 * scaleZ + z); GL11.glTexCoord2f(0.5f, 0.5f); GL11.glVertex3d(0.5 * scaleX + x, 0.5 * scaleY + y, -0.5 * scaleZ + z); GL11.glTexCoord2f(0.0f, 0.5f); GL11.glVertex3d(0.5 * scaleX + x, 0.5 * scaleY + y, 0.5 * scaleZ + z); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3d(0.5 * scaleX + x, -0.5 * scaleY + y, 0.5 * scaleZ + z); } // Front face if (drawFront) { GL11.glColor4f(CLOUD_COLOR_2.x, CLOUD_COLOR_2.y, CLOUD_COLOR_2.z, CLOUD_COLOR_2.w); GL11.glTexCoord2f(0.5f, 0.0f); GL11.glVertex3d(-0.5 * scaleX + x, -0.5 * scaleY + y, 0.5 * scaleZ + z); GL11.glTexCoord2f(0.5f, 0.0f); GL11.glVertex3d(0.5 * scaleX + x, -0.5 * scaleY + y, 0.5 * scaleZ + z); GL11.glTexCoord2f(0.5f, 0.5f); GL11.glVertex3d(0.5 * scaleX + x, 0.5 * scaleY + y, 0.5 * scaleZ + z); GL11.glTexCoord2f(0.0f, 0.5f); GL11.glVertex3d(-0.5 * scaleX + x, 0.5 * scaleY + y, 0.5 * scaleZ + z); } // Bottom Face GL11.glColor4f(CLOUD_COLOR_1.x, CLOUD_COLOR_1.y, CLOUD_COLOR_1.z, CLOUD_COLOR_1.w); GL11.glTexCoord2f(0.5f, 0.5f); GL11.glVertex3d(-0.5 * scaleX + x, -0.5 * scaleY + y, -0.5 * scaleZ + z); GL11.glTexCoord2f(0.0f, 0.5f); GL11.glVertex3d(0.5 * scaleX + x, -0.5 * scaleY + y, -0.5 * scaleZ + z); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3d(0.5 * scaleX + x, -0.5 * scaleY + y, 0.5 * scaleZ + z); GL11.glTexCoord2f(0.5f, 0.0f); GL11.glVertex3d(-0.5 * scaleX + x, -0.5 * scaleY + y, 0.5 * scaleZ + z); }
From source file:com.gjkf.fc.client.gui.inventory.CoreGui.java
License:Open Source License
@Override public void drawBackground() { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); /*this.mc.getTextureManager().bindTexture(new ResourceLocation("forecraft", "/textures/gui/coreBackground.png")); GuiDraw.drawNonStandartTexturedRect(0, 0, 0, 0, width, height, 512, 256);*/ drawDefaultBackground();/*from w w w .ja v a 2 s. c o m*/ }
From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
public void drawLine(int x1, int y1, int x2, int y2) { GL11.glDisable(GL11.GL_TEXTURE_2D);/*from www . j a v a 2s . co m*/ GL11.glColor4f((float) this.color.getRed() / 255f, (float) this.color.getGreen() / 255f, (float) this.color.getBlue() / 255f, (float) this.color.getAlpha() / 255f); GL11.glLineWidth(1.0f); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(x1, y1); GL11.glVertex2f(x2, y2); GL11.glEnd(); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glEnable(GL11.GL_TEXTURE_2D); }