List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:com.mrcrayfish.furniture.render.tileentity.CupRenderer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double posX, double posY, double posZ, float p_180535_8_, int p_180535_9_) { TileEntityCup tileEntityCup = (TileEntityCup) tileEntity; if (tileEntityCup.getDrink() != null) { Tessellator tessellator = Tessellator.getInstance(); GL11.glPushMatrix();/*from w w w . j a v a 2s . c om*/ GL11.glTranslatef((float) posX + 0.5F, (float) posY, (float) posZ + 0.5F); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(tileEntityCup.red / 255F, tileEntityCup.green / 255F, tileEntityCup.blue / 255F, 1.0F); GL11.glBegin(GL11.GL_QUADS); // North Face GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(0.125, 0.4, -0.125); GL11.glVertex3d(-0.125, 0.4, -0.125); // South Face GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125); GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125); GL11.glVertex3d(0.125, 0.4, 0.125); GL11.glVertex3d(-0.125, 0.4, 0.125); // West Face GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125); GL11.glVertex3d(-0.125, 0.4, 0.125); GL11.glVertex3d(-0.125, 0.4, -0.125); // East Face GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125); GL11.glVertex3d(0.125, 0.4, 0.125); GL11.glVertex3d(0.125, 0.4, -0.125); // Top Face GL11.glVertex3d(-0.125, 0.4, -0.125); GL11.glVertex3d(0.125, 0.4, -0.125); GL11.glVertex3d(0.125, 0.4, 0.125); GL11.glVertex3d(-0.125, 0.4, 0.125); // Bottom Face GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125); GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125); GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F); GL11.glPopMatrix(); } }
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void drawQuad() { // this func just draws a perfectly normal box with some texture coordinates GL11.glBegin(GL11.GL_QUADS);/*from www.ja v a 2 s . co m*/ // Front Face GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left Of The Texture and Quad GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right Of The Texture and Quad GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(1.0f, 1.0f, 0.0f); // Top Right Of The Texture and Quad GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left Of The Texture and Quad GL11.glEnd(); }
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void drawLatencyTesterColoredQuad(float r, float g, float b, float a) { GL11.glDisable(GL11.GL_TEXTURE_2D);/* w w w . j a va2s .c o m*/ GL11.glEnable(GL11.GL_BLEND); // Setup ortho projection GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0f, 0.0f, -0.7f); // Cover the appropriate areas of the screen with the colored quad GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(r, g, b, a); GL11.glVertex3f(-0.6f, -0.6f, 0.0f); // Bottom Left Of The Texture and Quad GL11.glVertex3f(0.6f, -0.6f, 0.0f); // Bottom Right Of The Texture and Quad GL11.glVertex3f(0.6f, 0.6f, 0.0f); // Top Right Of The Texture and Quad GL11.glVertex3f(-0.6f, 0.6f, 0.0f); // Top Left Of The Texture and Quad GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void drawQuad2(float displayWidth, float displayHeight, float scale) { float aspect = displayHeight / displayWidth; GL11.glBegin(GL11.GL_QUADS);/*from w ww. j a v a 2 s . c o m*/ GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(-1.0f * scale, -1.0f * aspect * scale, 0.0f); // Bottom Left Of The Texture and Quad GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(1.0f * scale, -1.0f * aspect * scale, 0.0f); // Bottom Right Of The Texture and Quad GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(1.0f * scale, 1.0f * aspect * scale, 0.0f); // Top Right Of The Texture and Quad GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(-1.0f * scale, 1.0f * aspect * scale, 0.0f); // Top Left Of The Texture and Quad GL11.glEnd(); }
From source file:com.parachute.client.RenderParachute.java
License:Open Source License
public void renderLargeParachuteCords(EntityPlayer rider, float center) { float zOffset = 3.0F; float x = 0.0F; float y = 2.5F; if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { // first person view y = 1.5F;// w ww . j av a2s . com } float zl = -zOffset; float zr = zOffset; float b = rider.getBrightness(center); GlStateManager.pushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GlStateManager.scale(0.0625F, -1.0F, 0.0625F); GL11.glBegin(GL11.GL_LINES); // left end GlStateManager.color(b * 0.5F, b * 0.5F, b * 0.65F); // slightly blue GL11.glVertex3f(-8F, 0.37F, -31.5F); // top - front GL11.glVertex3f(x, y, zl); // bottom GL11.glVertex3f(8F, 0.37F, -31.5F); // ...back GL11.glVertex3f(x, y, zl); // left middle GL11.glVertex3f(-8F, 0.12F, -16F); GL11.glVertex3f(x, y, zl); GL11.glVertex3f(8F, 0.12F, -16F); GL11.glVertex3f(x, y, zl); // right end GlStateManager.color(b * 0.65F, b * 0.5F, b * 0.5F); // slightly red GL11.glVertex3f(-8F, 0.37F, 31.5F); GL11.glVertex3f(x, y, zr); GL11.glVertex3f(8F, 0.37F, 31.5F); GL11.glVertex3f(x, y, zr); // right middle GL11.glVertex3f(-8F, 0.12F, 16F); GL11.glVertex3f(x, y, zr); GL11.glVertex3f(8F, 0.12F, 16F); GL11.glVertex3f(x, y, zr); // center GlStateManager.color(b * 0.5F, b * 0.65F, b * 0.5F); // slightly green GL11.glVertex3f(-8F, 0F, 0F); GL11.glVertex3f(x, y, zl); // first center cord goes to the left GL11.glVertex3f(8F, 0F, 0F); GL11.glVertex3f(x, y, zl); GL11.glVertex3f(-8F, 0F, 0F); // second center cord goes to the right GL11.glVertex3f(x, y, zr); GL11.glVertex3f(8F, 0F, 0F); GL11.glVertex3f(x, y, zr); GL11.glEnd(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GlStateManager.popMatrix(); }
From source file:com.parachute.client.RenderParachute.java
License:Open Source License
public void renderSmallParachuteCords(EntityPlayer rider, float center) { float zOffset = 3.0F; float x = 0.0F; float y = 1.5F; if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { // first person view y = 1.25F;// w w w. ja v a 2 s.c om } float zl = -zOffset; float zr = zOffset; float b = rider.getBrightness(center); GlStateManager.pushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GlStateManager.scale(0.0625F, -1.0F, 0.0625F); GL11.glBegin(GL11.GL_LINES); // left side GlStateManager.color(b * 0.5F, b * 0.5F, b * 0.65F); // slightly blue GL11.glVertex3f(-8F, 0.25F, -23.5F); GL11.glVertex3f(x, y, zl); GL11.glVertex3f(8F, 0.25F, -23.5F); GL11.glVertex3f(x, y, zl); // front GL11.glVertex3f(-8F, 0F, -8F); GL11.glVertex3f(x, y, zl); GL11.glVertex3f(8F, 0F, -8F); GL11.glVertex3f(x, y, zl); // right side GlStateManager.color(b * 0.65F, b * 0.5F, b * 0.5F); // slightly red GL11.glVertex3f(-8F, 0.25F, 23.5F); GL11.glVertex3f(x, y, zr); GL11.glVertex3f(8F, 0.25F, 23.5F); GL11.glVertex3f(x, y, zr); // back GL11.glVertex3f(-8F, 0F, 8F); GL11.glVertex3f(x, y, zr); GL11.glVertex3f(8F, 0F, 8F); GL11.glVertex3f(x, y, zr); GL11.glEnd(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GlStateManager.popMatrix(); }
From source file:com.runescape.client.revised.editor.modelviewer.Generator.java
License:Open Source License
public void draw() { GL11.glBegin(GL11.GL_QUADS);//from ww w . j av a 2 s . co m for (int i = 0; i < this.particleCount; i++) { if (this.particles[i] != null) { GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, this.decParticle.getWidth(), this.decParticle.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, this.bufParticle); GL11.glBindTexture(GL11.GL_ADD, GL11.GL_LOAD); GL11.glBindTexture(GL11.GL_TEXTURE_2D, 1); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glPushMatrix(); GL11.glTranslated(this.particles[i].x + (Main.getMain().getCanvas().getX() / 2), this.particles[i].y + (Main.getMain().getCanvas().getY() / 2), 0); this.particles[i].draw(); GL11.glPopMatrix(); } } GL11.glEnd(); }
From source file:com.runescape.client.revised.editor.modelviewer.Model3D.java
License:Open Source License
public void render(final float x, final float y, final float z, final float rx, final float ry, final float rz, final float sx, final float sy, final float sz) { GL11.glLoadIdentity();/* w w w . j a va 2 s. co m*/ GL11.glTranslatef(x, y, z); GL11.glRotatef(rx, 1.0F, 0.0F, 0.0F); GL11.glRotatef(ry, 0.0F, 1.0F, 0.0F); GL11.glRotatef(rz, 0.0F, 0.0F, 1.0F); GL11.glScalef(sx, sy, sz); final short[] tri_x = this.triangle_viewspace_x; final short[] tri_y = this.triangle_viewspace_y; final short[] tri_z = this.triangle_viewspace_z; // final short[] tex_map_x = this.texture_map_x; // final short[] tex_map_y = this.texture_map_y; // final short[] tex_map_z = this.texture_map_z; final short[] textures = this.textures; final int[] vertices_x = this.vertices_x; final int[] vertices_y = this.vertices_y; final int[] vertices_z = this.vertices_z; final short[] colors = this.colors; final float model_scale = 4.0F; final float texture_scale = 1.0F; if (this.pointers != null) { //glEnable(GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); //GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); //GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); } Texture texture = null; for (int triangle = 0; triangle != this.triangle_count; ++triangle) { if ((this.alpha != null) && (this.alpha[triangle] == -1)) { continue; } final int point_a = tri_x[triangle]; final int point_b = tri_y[triangle]; final int point_c = tri_z[triangle]; final int color = Model.hsl2rgb[colors[triangle] & 0xffff]; int triangle_type; if (this.face_fill_attributes == null) { triangle_type = 0; } else { triangle_type = this.face_fill_attributes[triangle] & 3; } if ((textures != null) && (textures[triangle] != -1)) { final int id = textures[triangle] & 0xffff; if (ModelConstants.ENABLE_MODEL_TEXTURES && ((texture == null) && (id != -1))) { texture = TextureCache.get(id); } if (texture != null) { texture.bind(); } } final boolean textured = ModelConstants.ENABLE_MODEL_TEXTURES && (texture != null); GL11.glBegin(GL11.GL_TRIANGLES); GL11.glColor4ub((byte) (color >>> 16), (byte) (color >>> 8), (byte) color, (byte) (this.alpha == null ? 0xff : ~this.alpha[triangle])); switch (triangle_type) { case 0://shaded triangle case 1://flat triangle if (textured) { GL11.glTexCoord2f(0.0F, 0.0F); } GL11.glVertex3f(vertices_x[point_a] / model_scale, vertices_y[point_a] / model_scale, vertices_z[point_a] / model_scale); if (textured) { GL11.glTexCoord2f(0.0F, texture_scale / model_scale); } GL11.glVertex3f(vertices_x[point_b] / model_scale, vertices_y[point_b] / model_scale, vertices_z[point_b] / model_scale); if (textured) { GL11.glTexCoord2f(texture_scale / model_scale, texture_scale / model_scale); } GL11.glVertex3f(vertices_x[point_c] / model_scale, vertices_y[point_c] / model_scale, vertices_z[point_c] / model_scale); break; case 2://textured? case 3://textured? final int ptr = this.face_fill_attributes[triangle] >> 2; final int tex_point_a = this.texture_map_x[ptr]; final int tex_point_b = this.texture_map_y[ptr]; final int tex_point_c = this.texture_map_z[ptr]; GL11.glTexCoord2f(0.0F, 0.0F); GL11.glVertex3f(vertices_x[tex_point_a] / model_scale, vertices_y[tex_point_a] / model_scale, vertices_z[tex_point_a] / model_scale); GL11.glTexCoord2f(0.0F, texture_scale / model_scale); GL11.glVertex3f(vertices_x[tex_point_b] / model_scale, vertices_y[tex_point_b] / model_scale, vertices_z[tex_point_b] / model_scale); GL11.glTexCoord2f(texture_scale / model_scale, texture_scale / model_scale); GL11.glVertex3f(vertices_x[tex_point_c] / model_scale, vertices_y[tex_point_c] / model_scale, vertices_z[tex_point_c] / model_scale); break; } GL11.glEnd(); } if (texture != null) { GL11.glDisable(GL11.GL_TEXTURE_2D); } }
From source file:com.rvantwisk.cnctools.controls.opengl.OpenGLRenderer.java
License:Open Source License
protected void drawAxis(float length) { GL11.glPushMatrix();//from www.j a v a 2 s . co m this.viewModel.ui_transform(length + length / 2.0f); float[][] axis = { { length, 0.0f, 0.0f }, { 0.0f, -length, 0.0f }, { 0.0f, 0.0f, length } }; float[][] colors = { { 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 0.5f, 1.0f } }; String[] names = { "X", "Y", "Z" }; GL11.glBegin(GL11.GL_LINES); for (int i = 0; i < 3; i++) { GL11.glColor3f(colors[i][0], colors[i][1], colors[i][2]); GL11.glVertex3f(0.0f, 0.0f, 0.0f); GL11.glVertex3f(axis[i][0], axis[i][1], axis[i][2]); } GL11.glEnd(); // TODO optmize text rendering, lack of glutBitmapCharacter forces me to do it differently. for (int i = 0; i < 3; i++) { GL11.glPushMatrix(); GL11.glColor3f(colors[i][0], colors[i][1], colors[i][2]); // http://breadmilkbeercigarettes.com/bmbc/shelves/users/bbb/src/java/SpinningTextureCube.php GL11.glTranslatef(Math.round(axis[i][0]), Math.round(axis[i][1]), Math.round(axis[i][2])); GL11.glRotatef(camera.getElevation() + 90f, 1.0f, 0.0f, 0.0f); GL11.glRotatef(-camera.getAzimuth(), 0.0f, 1.0f, 0.0f); SimpleText.drawString(names[i], 0.0f, 0.0f, 0.0f); // GL11.glRasterPos3f(Math.round(axis[i][0]), Math.round(axis[i][1]), Math.round(axis[i][2])); // SimpleText.drawString(names[i], 0, 0); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:com.rvantwisk.cnctools.controls.opengl.PlatformActor.java
License:Open Source License
@Override public void initialize() { display_list = GL11.glGenLists(1);/* www . ja v a2 s . co m*/ GL11.glNewList(display_list, GL11.GL_COMPILE); // draw the grid GL11.glBegin(GL11.GL_LINES); for (int i = xneg; i <= xpos; i += openNess) { setColor(i); GL11.glVertex3f(i, yneg, ZPOS); GL11.glVertex3f(i, ypos, ZPOS); } for (int i = yneg; i <= ypos; i += openNess) { setColor(i); GL11.glVertex3f(xneg, i, ZPOS); GL11.glVertex3f(xpos, i, ZPOS); } GL11.glColor4f(color_fill[0], color_fill[1], color_fill[2], color_fill[3]); GL11.glRectf(xneg, yneg, xpos, ypos); GL11.glEnd(); GL11.glEndList(); }