List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
public static void drawGradientRect(double x, double y, double x2, double y2, int col1, int col2) { float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; float f4 = ((col2 >> 24) & 0xFF) / 255F; float f5 = ((col2 >> 16) & 0xFF) / 255F; float f6 = ((col2 >> 8) & 0xFF) / 255F; float f7 = (col2 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND);/*from w w w . j a v a2s. com*/ GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(f1, f2, f3, f); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y); GL11.glColor4f(f5, f6, f7, f4); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glShadeModel(GL11.GL_FLAT); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
public static void drawGBRect(double x, double y, double x2, double y2, float l1, int col1, int col2, int col3) { float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; GL11.glDisable(GL11.GL_TEXTURE_2D);/* w ww . j ava 2 s. c om*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_BLEND); GL11.glPushMatrix(); GL11.glColor4f(f1, f2, f3, f); GL11.glLineWidth(1F); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2d(x, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); drawGradientRect(x, y, x2, y2, col2, col3); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
From source file:com.lion328.thaifixes.nmod.ThaiFixesFontRenderer.java
License:Open Source License
private float renderThaiChar(char c, boolean italic) { try {/*from w w w. ja va2s . c o m*/ float cPosX, cPosY; switch (ThaiFixesConfiguration.getFontStyle()) { default: case UNICODE: if (ThaiFixesUtils.isSpecialThaiChar(c)) { //posX.setFloat(this, posX.getFloat(this) - 4); // move character to before character position byte size = ((byte[]) glyphWidth.get(this))[c]; if (size == 0) return 0.0F; else { invokeMethod("loadGlyphTexture", new Class[] { int.class }, (int) (c / 256)); // load texture float charHeightOnTexture = 4.98F, beginTexcoordY = ThaiFixesUtils.isLowerThaiChar(c) ? 15.98F - charHeightOnTexture : 0F, quadHeight = charHeightOnTexture / 2; // vertex position, not for texture coordinate. // glyphWidth format: // XXXXYYYY, XXXX as start X position on texture coordinate and YYYY as width. float startTexcoordX = (float) (size >>> 4); float charWidth = (float) ((size & 0xF) + 1); float texcoordX = (float) (c % 16 * 16) + startTexcoordX; float texcoordY = (float) ((c & 255) / 16 * 16); float realCharWidth = charWidth - startTexcoordX - 0.02F; float italicSize = italic ? 1.0F : 0.0F; cPosX = posX.getFloat(this) - (realCharWidth + 0.02F) / 2 - 1; // get current position cPosY = posY.getFloat(this); GL11.glBegin(GL11.GL_TRIANGLE_STRIP); GL11.glTexCoord2f(texcoordX / 256.0F, (texcoordY + beginTexcoordY) / 256.0F); GL11.glVertex2f(cPosX + italicSize, cPosY + (beginTexcoordY / 2)); GL11.glTexCoord2f(texcoordX / 256.0F, (texcoordY + beginTexcoordY + charHeightOnTexture) / 256.0F); GL11.glVertex2f(cPosX - italicSize, cPosY + (beginTexcoordY / 2) + quadHeight); GL11.glTexCoord2f((texcoordX + realCharWidth) / 256.0F, (texcoordY + beginTexcoordY) / 256.0F); GL11.glVertex2f(cPosX + realCharWidth / 2.0F + italicSize, cPosY + (beginTexcoordY / 2)); GL11.glTexCoord2f((texcoordX + realCharWidth) / 256.0F, (texcoordY + beginTexcoordY + charHeightOnTexture) / 256.0F); GL11.glVertex2f(cPosX + realCharWidth / 2.0F - italicSize, cPosY + (beginTexcoordY / 2) + quadHeight); GL11.glEnd(); return 0;//(realCharWidth + 0.02F) / 2.0F + 1.0F; } } case DISABLE: return (Float) invokeMethod("renderUnicodeChar", new Class[] { char.class, boolean.class }, c, italic); case MCPX: //if(ThaiFixesUtils.isSpecialThaiChar(c)) posX.setFloat(this, posX.getFloat(this) - 5.0F); int posOnArray = c - THAI_CHAR_START; cPosX = posX.getFloat(this) - (ThaiFixesUtils.isSpecialThaiChar(c) ? thaiCharWidth[posOnArray] : 0F); // get current position cPosY = posY.getFloat(this) + (ThaiFixesUtils .isSpecialThaiChar(c) ? (ThaiFixesUtils.isUpperThaiChar(c) ? -7.0F : 2.0F) - (!ThaiFixesUtils.isSpecialSpecialThaiChar(beforeChar) ? (ThaiFixesUtils .isSpecialThaiChar(beforeChar) ? 2.0F : (ThaiFixesUtils.isVeryLongTailThaiChar( beforeChar) ? 1.0F : 0.0F)) : 0.0F) : 0.0F); float texcoordX = (float) (posOnArray % 16 * 8); float texcoordY = (float) (posOnArray / 16 * 8); float italicSize = italic ? 1.0F : 0.0F; renderEngine.bindTexture(mcpx_font); float f3 = (float) thaiCharWidth[posOnArray] - 0.01F; GL11.glBegin(GL11.GL_TRIANGLE_STRIP); GL11.glTexCoord2f(texcoordX / 128.0F, texcoordY / 128.0F); GL11.glVertex2f(cPosX + italicSize, cPosY); GL11.glTexCoord2f(texcoordX / 128.0F, (texcoordY + 7.99F) / 128.0F); GL11.glVertex2f(cPosX - italicSize, cPosY + 7.99F); GL11.glTexCoord2f((texcoordX + f3 - 1.0F) / 128.0F, texcoordY / 128.0F); GL11.glVertex2f(cPosX + f3 - 1.0F + italicSize, cPosY); GL11.glTexCoord2f((texcoordX + f3 - 1.0F) / 128.0F, (texcoordY + 7.99F) / 128.0F); GL11.glVertex2f(cPosX + f3 - 1.0F - italicSize, cPosY + 7.99F); GL11.glEnd(); return ThaiFixesUtils.isSpecialThaiChar(c) ? 0 : (float) thaiCharWidth[posOnArray]; } } catch (Exception e) { System.out.println("[ThaiFixes] Error during render an thai character '" + c + "'" + (italic ? " with italic style" : "") + "."); e.printStackTrace(); } return 0.0F; }
From source file:com.lukke100.sbdi.Draw.java
License:Open Source License
static public void drawCircle(double xCoord, double yCoord, double radius, int segments) { GL11.glColor3d(red, green, blue);//from w ww . j a v a 2 s. c om GL11.glBegin(GL11.GL_TRIANGLE_FAN); // GL11.glVertex2d(xCoord, yCoord); double deltaAngle = (2 * Math.PI) / segments; for (double angle = 0; angle < Math.PI * 2; angle += deltaAngle) { GL11.glVertex2d(xCoord + Math.cos(angle) * radius, yCoord + Math.sin(angle) * radius); } GL11.glEnd(); }
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);/*ww w . j a va2 s. co m*/ double theta = (2 * Math.PI) / segments; double c = Math.cos(theta); double s = Math.sin(theta); double t; 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);/*from w ww . ja va 2 s. c o m*/ width--; 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);//from w w w . ja v a2 s. c o m size--; 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);/*from w ww . ja v a 2s . c o m*/ GL11.glBegin(GL11.GL_QUADS); 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);//from w ww . j a v a2s .c om GL11.glBegin(GL11.GL_QUADS); 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.mrcrayfish.furniture.render.tileentity.BlenderRenderer.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_) { TileEntityBlender blender = (TileEntityBlender) tileEntity; ItemStack[] ingredients = blender.getIngredients(); GL11.glPushMatrix();/* w w w. j a v a 2 s . c o m*/ GL11.glTranslatef((float) posX + 0.5F, (float) posY + 0.2F, (float) posZ + 0.5F); GL11.glScalef(0.65F, 0.65F, 0.65F); entityFood.hoverStart = 0.0F; for (int i = 0; i < ingredients.length; i++) { if (ingredients[i] != null) { entityFood.setEntityItemStack(ingredients[i]); GL11.glRotatef(i * -90F, 0, 1, 0); GL11.glRotatef(blender.progress * 18F, 0, 1, 0); Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityFood, 0.0D, 0.2D, 0.0D, 0.0F, 0.0F); } } GL11.glPopMatrix(); if (blender.isBlending() | blender.drinkCount > 0) { Tessellator tessellator = Tessellator.getInstance(); GL11.glPushMatrix(); GL11.glTranslatef((float) posX + 0.5F, (float) posY + 0.05F, (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); float alpha = blender.isBlending() ? (blender.progress / 200F) : (blender.drinkCount > 0 ? 1.0F : 0.0F); GL11.glColor4f(blender.currentRed / 255F, blender.currentGreen / 255F, blender.currentBlue / 255F, alpha); float height = blender.isBlending() ? 0.8F : (0.275F + (0.525F * (blender.drinkCount / 6F))); GL11.glBegin(GL11.GL_QUADS); // North Face GL11.glVertex3d(-0.2, 0.275, -0.2); GL11.glVertex3d(0.2, 0.275, -0.2); GL11.glVertex3d(0.2, height, -0.2); GL11.glVertex3d(-0.2, height, -0.2); // South Face GL11.glVertex3d(-0.2, 0.275, 0.2); GL11.glVertex3d(0.2, 0.275, 0.2); GL11.glVertex3d(0.2, height, 0.2); GL11.glVertex3d(-0.2, height, 0.2); // West Face GL11.glVertex3d(-0.2, 0.275, -0.2); GL11.glVertex3d(-0.2, 0.275, 0.2); GL11.glVertex3d(-0.2, height, 0.2); GL11.glVertex3d(-0.2, height, -0.2); // East Face GL11.glVertex3d(0.2, 0.275, -0.2); GL11.glVertex3d(0.2, 0.275, 0.2); GL11.glVertex3d(0.2, height, 0.2); GL11.glVertex3d(0.2, height, -0.2); // Top Face GL11.glVertex3d(-0.2, height, -0.2); GL11.glVertex3d(0.2, height, -0.2); GL11.glVertex3d(0.2, height, 0.2); GL11.glVertex3d(-0.2, height, 0.2); // Bottom Face GL11.glVertex3d(-0.2, 0.275, -0.2); GL11.glVertex3d(0.2, 0.275, -0.2); GL11.glVertex3d(0.2, 0.275, 0.2); GL11.glVertex3d(-0.2, 0.275, 0.2); 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(); } }