List of usage examples for org.lwjgl.opengl GL11 glVertex2f
public static native void glVertex2f(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y);
From source file:com.jmex.bui.background.TintedBackground.java
License:Open Source License
public void render(Renderer renderer, int x, int y, int width, int height, float alpha) { super.render(renderer, x, y, width, height, alpha); BComponent.applyDefaultStates();//from w w w . java 2s . co m BImage.blendState.apply(); GL11.glColor4f(_color.r, _color.g, _color.b, _color.a * alpha); 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(); }
From source file:com.jmex.bui.border.LineBorder.java
License:Open Source License
@Override // from BBorder/*from w ww . j a v a 2 s . co m*/ public void render(Renderer renderer, int x, int y, int width, int height, float alpha) { super.render(renderer, x, y, width, height, alpha); BComponent.applyDefaultStates(); BImage.blendState.apply(); if (_width > 0) { RenderContext ctx = DisplaySystem.getDisplaySystem().getCurrentContext(); GL11.glColor4f(_color.r, _color.g, _color.b, _color.a * alpha); // First draw the bottom line. if (_bottom > 0) { ((LineRecord) ctx.getLineRecord()).applyLineWidth(_bottom); float offset = _bottom / 2f; GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2f(x - offset, y); GL11.glVertex2f(x + width, y); GL11.glEnd(); } // Next draw the right hand side. if (_right > 0) { ((LineRecord) ctx.getLineRecord()).applyLineWidth(_right); float offset = _right / 2f; GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2f(x + width - offset, y); GL11.glVertex2f(x + width - offset, y + height); GL11.glEnd(); } // Next draw the top line. if (_top > 0) { ((LineRecord) ctx.getLineRecord()).applyLineWidth(_top); float offset = _top / 2f; GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2f(x + width, y + height - offset); GL11.glVertex2f(x - offset, y + height - offset); GL11.glEnd(); } // Last draw the left hand side. if (_left > 0) { ((LineRecord) ctx.getLineRecord()).applyLineWidth(_left); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2f(x, y + height); GL11.glVertex2f(x, y); GL11.glEnd(); } } }
From source file:com.jmex.bui.BRootNode.java
License:Open Source License
protected void renderModalShade() { BComponent.applyDefaultStates();/*from w w w . j a va2 s .c om*/ BImage.blendState.apply(); int width = DisplaySystem.getDisplaySystem().getWidth(); int height = DisplaySystem.getDisplaySystem().getHeight(); GL11.glColor4f(_modalShade.r, _modalShade.g, _modalShade.b, _modalShade.a); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(width, 0); GL11.glVertex2f(width, height); GL11.glVertex2f(0, height); GL11.glEnd(); }
From source file:com.jmex.bui.BTextField.java
License:Open Source License
@Override // documentation inherited protected void renderComponent(Renderer renderer) { super.renderComponent(renderer); Insets insets = getInsets();/* w w w. j a v a 2s . c o m*/ // render our text if (_glyphs != null) { // clip the text to our visible text region boolean scissored = intersectScissorBox(_srect, getAbsoluteX() + insets.left, getAbsoluteY() + insets.bottom, _width - insets.getHorizontal(), _height - insets.getVertical()); try { _glyphs.render(renderer, insets.left - _txoff, insets.bottom, _alpha); } finally { restoreScissorState(scissored, _srect); } } // render the cursor if we have focus if (_showCursor) { int cx = insets.left - _txoff + _cursx; BComponent.applyDefaultStates(); ColorRGBA c = getColor(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2f(cx, insets.bottom); int cheight = getTextFactory().getHeight(); GL11.glVertex2f(cx, insets.bottom + cheight); GL11.glEnd(); } }
From source file:com.lion328.thaifixes.nmod.ThaiFixesFontRenderer.java
License:Open Source License
private float renderThaiChar(char c, boolean italic) { try {/*www . ja v a2 s .co 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.ogrekill.textMessage.java
public void textMessage() { GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(800, 0); GL11.glVertex2f(800, 200); GL11.glVertex2f(0, 200); }
From source file:com.samrj.devil.geo2d.AAB2.java
License:Open Source License
public void glVertex() { GL11.glVertex2f(x0, y0); GL11.glVertex2f(x0, y1); GL11.glVertex2f(x1, y1); GL11.glVertex2f(x1, y0); }
From source file:com.samrj.devil.geo2d.AAB2.java
License:Open Source License
public void glTexVertex() { GL11.glTexCoord2f(0f, 0f);/* w ww . ja v a 2 s . co m*/ GL11.glVertex2f(x0, y0); GL11.glTexCoord2f(0f, 1f); GL11.glVertex2f(x0, y1); GL11.glTexCoord2f(1f, 1f); GL11.glVertex2f(x1, y1); GL11.glTexCoord2f(1f, 0f); GL11.glVertex2f(x1, y0); }
From source file:com.samrj.devil.geo2d.Box.java
License:Open Source License
public void glVertex() { for (Vec2 v : vertices()) GL11.glVertex2f(v.x, v.y); }
From source file:com.samrj.devil.graphics.GraphicsUtil.java
public static void glVertex(Vec2 v) { GL11.glVertex2f(v.x, v.y); }