List of usage examples for org.lwjgl.opengl GL11 glVertex2i
public static native void glVertex2i(@NativeType("GLint") int x, @NativeType("GLint") int y);
From source file:a1.Render2D.java
License:Open Source License
static public void Vertex(Coord v) { GL11.glVertex2i(v.x, v.y); }
From source file:ai.UnitAI.java
License:Open Source License
public void draw() { icon.bind();/*from ww w.j a v a 2 s . c om*/ GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(0, 0); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(0, 64); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(64, 64); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(64, 0); GL11.glEnd(); }
From source file:com.ardor3d.renderer.lwjgl.LwjglFont.java
License:Open Source License
/** * <code>buildDisplayList</code> sets up the 256 display lists that are used to render each font character. Each * list quad is 16x16, as defined by the font image size. *//*from www . j a v a2s .c om*/ public void buildDisplayList() { float cx; float cy; base = GL11.glGenLists(256); for (int loop = 0; loop < 256; loop++) { cx = (loop % 16) / 16.0f; cy = (loop / 16) / 16.0f; GL11.glNewList(base + loop, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(cx, 1 - cy - 0.0625f); GL11.glVertex2i(0, 0); GL11.glTexCoord2f(cx + 0.0625f, 1 - cy - 0.0625f); GL11.glVertex2i(16, 0); GL11.glTexCoord2f(cx + 0.0625f, 1 - cy); GL11.glVertex2i(16, 16); GL11.glTexCoord2f(cx, 1 - cy); GL11.glVertex2i(0, 16); GL11.glEnd(); GL11.glTranslatef(10, 0, 0); GL11.glEndList(); } }
From source file:com.headswilllol.mineflat.gui.GuiElement.java
License:Open Source License
public void draw() { if (isActive()) { GL11.glColor4f(color.getX(), color.getY(), color.getZ(), color.getW()); GL11.glBegin(GL11.GL_QUADS);/* w w w. j a v a2s. c o m*/ GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + size.getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + size.getX(), getAbsolutePosition().getY() + size.getY()); GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY() + size.getY()); GL11.glEnd(); for (GuiElement ge : children.values()) { ge.draw(); } } }
From source file:com.headswilllol.mineflat.gui.TextField.java
License:Open Source License
@Override public void draw() { if (isActive()) { GL11.glColor4f(bgColor.getX(), bgColor.getY(), bgColor.getZ(), bgColor.getW()); GL11.glBegin(GL11.GL_QUADS);/*w ww . j av a2 s.c om*/ GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + getSize().getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + getSize().getX(), getAbsolutePosition().getY() + getSize().getY()); GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY() + getSize().getY()); GL11.glEnd(); GL11.glColor4f(textColor.getX(), textColor.getY(), textColor.getZ(), textColor.getW()); GraphicsHandler.drawString(getText(), getAbsolutePosition().getX() + 3, getAbsolutePosition().getY() + 3, getSize().getY() - 6, false); if (selected == this) { GL11.glBegin(GL11.GL_QUADS); int /* I got 'em foaming from the mouth and I just hit 'em with the */ baseX = getAbsolutePosition() .getX() + GraphicsHandler.getStringLength(getText().substring(0, column + 1), getSize().getY() - 6) + 1; int baseY = getAbsolutePosition().getY() + 1; GL11.glVertex2i(baseX, baseY); GL11.glVertex2i(baseX + 2, baseY); GL11.glVertex2i(baseX + 2, baseY + getSize().getY() - 2); GL11.glVertex2i(baseX, baseY + getSize().getY() - 2); GL11.glEnd(); } } }
From source file:com.teambrmodding.luxetumbra.client.gui.GuiToggleMenu.java
License:Creative Commons License
@Override public void drawScreen(int mx, int my, float partialTicks) { super.drawScreen(mx, my, partialTicks); GlStateManager.pushMatrix();/*from w w w .ja va 2 s. co m*/ GlStateManager.disableTexture2D(); final int x = width / 2; final int y = height / 2; final int maxRadius = 60; final boolean mouseIn = true; final float angle = mouseAngle(x, y, mx, my); final float distance = mouseDistance(x, y, mx, my); final int highlight = 5; GlStateManager.enableBlend(); GlStateManager.shadeModel(GL11.GL_SMOOTH); final int segments = 2; //TODO float totalDeg = 0F; final float degPer = 360F / segments; final List<int[]> stringPosition = new ArrayList<>(); boolean wasSelected = false; for (int seg = 0; seg <= segments; seg++) { boolean mouseOverSection = distance <= maxRadius && (mouseIn && angle > totalDeg && angle < totalDeg + degPer); float radius = Math.max(0F, Math.min(timeIn * 10F, maxRadius)); GL11.glBegin(GL11.GL_TRIANGLE_FAN); float gs = 0.25F; if (seg % 2 == 0) gs += 0.1F; float r = 200; //TODO float g = 200; //TODO float b = gs; float a = 0.4F; if (mouseOverSection) { selected = seg; wasSelected = true; r = 255; //TODO g = 255; //TODO a = 0.5F; } GlStateManager.color(r, g, b, a); GL11.glVertex2i(x, y); float i = degPer; while (i >= 0) { double rad = ((i + totalDeg) / 180F * Math.PI); double xp = x + Math.cos(rad) * radius; double yp = y + Math.sin(rad) * radius; if (i == (int) (degPer / 2)) stringPosition.add(new int[] { seg, (int) xp, (int) yp, mouseOverSection ? 'n' : 'r' }); GL11.glVertex2d(xp, yp); i -= 1; } totalDeg += degPer; GL11.glVertex2i(x, y); GL11.glEnd(); if (mouseOverSection) radius -= highlight; } if (!wasSelected) selected = -1; GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.enableTexture2D(); for (int[] pos : stringPosition) { int slot = pos[0]; float xp = pos[1]; float yp = pos[2]; char c = (char) pos[3]; ItemStack displayStack = new ItemStack(Items.APPLE); if (displayStack != null) { float xsp = xp - 4; float ysp = yp; String name = "\u00a7" + c + "testing"; int width = fontRendererObj.getStringWidth(name); float mod = 0.6F; int xdp = (int) ((xp - x) * mod + x); int ydp = (int) ((yp - y) * mod + y); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.pushMatrix(); GlStateManager.translate(xdp - 10, ydp - 10, 2); GlStateManager.scale(1.25, 1.25, 1.25); Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(displayStack, 0, 0); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); if (xsp < x) xsp -= width - 8; if (ysp < y) ysp -= 9; fontRendererObj.drawStringWithShadow(name, xsp, ysp, 0xFFFFFF); } } GlStateManager.popMatrix(); }
From source file:com.telinc1.rpjg.module.Module.java
License:Apache License
/** * Renders the module's graphics and UI elements. * Also applied the screen darkening effect for modal modules.<br /> * Generally not a good idea to override this. *///from w w w. j a va 2 s . c o m public void render() { if (this.isModal()) { DrawingUtils.unbindTextures(); // Not going to change this to use DrawingUtils until // I don't make actual modal modules. // Don't want untested code! GL11.glPushAttrib(DrawingUtils.GL_COLOR_BITS); GL11.glColor4f(0f, 0f, 0f, .5f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(0, 0); GL11.glVertex2i(Display.getWidth(), 0); GL11.glVertex2i(Display.getWidth(), Display.getHeight()); GL11.glVertex2i(0, Display.getHeight()); GL11.glEnd(); GL11.glPopAttrib(); } this.renderGraphics(); this.renderUI(); for (Gui gui : this.getGUIs()) { gui.render(); } }
From source file:com.telinc1.rpjg.util.DrawingUtils.java
License:Apache License
/** * Draws a rectangle at the given coordinates, but * assumes the texture for it has already been bound. * //from w w w. ja va2s . c o m * @param x - The X coordinate of the rectangle. * @param y - The Y coordinate of the rectangle. * @param width - The width of the rectangle. * @param height - The height of the rectangle. */ public static void drawTexturedQuad(int x, int y, int width, int height) { DrawingUtils.startDrawing(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(x, y); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(x + width, y); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(x + width, y + height); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(x, y + height); DrawingUtils.stopDrawing(); }
From source file:com.telinc1.rpjg.util.DrawingUtils.java
License:Apache License
/** * Draws a textured rectangle, but uses a texture mapper * to pull its texture from an atlas.//w ww. ja v a2 s.c o m * * @param mapper - The {@link TextureMapper texture mapper} to use. * @param x - The X coordinate of the rectangle. * @param y - The Y coordinate of the rectangle. * @param width - The width of the rectangle. * @param height - The height of the rectangle. */ public static void drawMappedQuad(TextureMapper mapper, int x, int y, int width, int height) { if (mapper.getTexture().getID() != DrawingUtils.boundTexture) { DrawingUtils.bindTexture(mapper.getTexture()); } DrawingUtils.startDrawing(GL11.GL_QUADS); GL11.glTexCoord2f(mapper.getU(), mapper.getV()); GL11.glVertex2i(x, y); GL11.glTexCoord2f(mapper.getU2(), mapper.getV()); GL11.glVertex2i(x + width, y); GL11.glTexCoord2f(mapper.getU2(), mapper.getV2()); GL11.glVertex2i(x + width, y + height); GL11.glTexCoord2f(mapper.getU(), mapper.getV2()); GL11.glVertex2i(x, y + height); DrawingUtils.stopDrawing(); }
From source file:com.telinc1.rpjg.util.DrawingUtils.java
License:Apache License
/** * Draws a textured rectangle with a texture mapper, * but doesn't start of end drawing./*from w w w. ja v a 2 s .co m*/ * * @param mapper - The {@link TextureMapper texture mapper} to use. * @param x - The X coordinate of the rectangle. * @param y - The Y coordinate of the rectangle. * @param width - The width of the rectangle. * @param height - The height of the rectangle. */ public static void drawConsecutiveMappedQuad(TextureMapper mapper, int x, int y, int width, int height) { GL11.glTexCoord2f(mapper.getU(), mapper.getV()); GL11.glVertex2i(x, y); GL11.glTexCoord2f(mapper.getU2(), mapper.getV()); GL11.glVertex2i(x + width, y); GL11.glTexCoord2f(mapper.getU2(), mapper.getV2()); GL11.glVertex2i(x + width, y + height); GL11.glTexCoord2f(mapper.getU(), mapper.getV2()); GL11.glVertex2i(x, y + height); }