List of usage examples for org.lwjgl.opengl GL11 glTranslated
public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:org.spout.api.gui.screen.ScreenStack.java
License:Open Source License
@Override public void render() { for (Screen screen : visibleScreens) { GL11.glTranslated(screen.getGeometry().x, screen.getGeometry().y, 0); GL11.glPushMatrix();/*from w w w. ja va 2s.c o m*/ screen.render(); GL11.glPopMatrix(); } }
From source file:org.spoutcraft.api.gui.GenericPolygon.java
License:Open Source License
public void render() { GL11.glDisable(GL11.GL_TEXTURE_2D);/*w w w. j a va 2s. c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(770, 771); GL11.glShadeModel(GL11.GL_SMOOTH); MinecraftTessellator t = Spoutcraft.getTessellator(); GL11.glTranslated(getActualX(), getActualY(), 0); t.startDrawingQuads(); for (Pair<Point, Color> point : points) { Point p = point.getLeft(); Color c = point.getRight(); t.setColorRGBAFloat(c.getRedF(), c.getGreenF(), c.getBlueF(), c.getAlphaF()); t.addVertex(p.getX(), p.getY(), 0); } t.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:org.spoutcraft.client.entity.RenderText.java
License:Open Source License
@Override public void doRender(Entity entity, double x, double y, double z, float yaw, float pitch) { EntityText entitytext = (EntityText) entity; String text = entitytext.getText(); yaw = entitytext.isRotateWithPlayer() ? this.renderManager.playerViewY : yaw; RenderHelper.disableStandardItemLighting(); GL11.glPushMatrix();/* www .ja v a2 s .com*/ float scale = entitytext.getScale() * 0.124f; GL11.glTranslated(x, y + 1, z); GL11.glScalef(scale, scale, scale); GL11.glRotatef(180f, 0, 0f, 1f); int stringwidth = SpoutClient.getInstance().getRenderDelegate().getMinecraftFont().getTextWidth(text); GL11.glRotatef(yaw, 0, 1f, 0); GL11.glTranslated(-stringwidth / 2d, 0, 0); SpoutClient.getHandle().fontRenderer.drawString(text, 0, 0, 0xffffffff); GL11.glPopMatrix(); RenderHelper.enableStandardItemLighting(); }
From source file:org.spoutcraft.client.entity.RenderTexture.java
License:Open Source License
@Override public void doRender(Entity entity, double x, double y, double z, float yaw, float pitch) { EntityTexture entityT = (EntityTexture) entity; if (entityT.texture == null) { entityT.texture = CustomTextureManager.getTextureFromUrl(entityT.getUrl()); if (entityT.texture == null) { return; }/*from w ww .j a va 2 s. c o m*/ } GL11.glPushMatrix(); RenderHelper.disableStandardItemLighting(); yaw = entityT.isRotateWithPlayer() ? -this.renderManager.playerViewY : yaw; GL11.glTranslated(x, y, z); GL11.glRotatef(yaw, 0, 1.0F, 0); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); SpoutClient.getHandle().renderEngine.bindTexture(entityT.texture.getTextureID()); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); double h = entityT.height * 0.014; double w = entityT.width * 0.014; tessellator.addVertexWithUV(w / 2, -h / 2, 0, 0.0D, 0.0D); // Draw corners tessellator.addVertexWithUV(-w / 2, -h / 2, 0, entityT.texture.getWidth(), 0.0D); tessellator.addVertexWithUV(-w / 2, h / 2, 0, entityT.texture.getWidth(), entityT.texture.getHeight()); tessellator.addVertexWithUV(w / 2, h / 2, 0, 0.0D, entityT.texture.getHeight()); tessellator.draw(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); }
From source file:org.spoutcraft.client.gui.MCRenderDelegate.java
License:Open Source License
public void render(GenericEntityWidget entityWidget) { Entity entity = SpoutClient.getInstance().getEntityFromId(entityWidget.getEntityId()); if (entity != null) { GL11.glEnable(32826);/*from ww w.jav a 2 s.c o m*/ GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslated(entityWidget.getX() + entityWidget.getWidth() / 2, entityWidget.getY() + entityWidget.getHeight(), 50F); RenderHelper.enableStandardItemLighting(); float f1 = (float) Math.min(entityWidget.getWidth(), entityWidget.getHeight()); GL11.glScalef(-f1, f1, f1); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(entity.prevRotationYaw, 0, 1.0F, 0); RenderHelper.enableStandardItemLighting(); RenderManager.instance.playerViewY = 180F; RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glDisable(32826); } }
From source file:org.spoutcraft.client.gui.MCRenderDelegate.java
License:Open Source License
public void render(GenericListWidgetItem lwi, int x, int y, int width, int height) { if (lwi.getIconUrl() != null && !lwi.getIconUrl().isEmpty()) { Texture t = CustomTextureManager.getTextureFromUrl(lwi.getIconUrl()); if (t != null) { int maxHeight = height - 4; float f = (float) t.getImageWidth() / (float) t.getImageHeight(); int w = (int) (maxHeight * f); GL11.glTranslated(6, (y + 2), 0); drawTexture(t, maxHeight, w); GL11.glTranslated(-6, (-(y + 2)), 0); x += 2 + w;//from w w w . ja v a 2 s .c o m } } FontRenderer font = SpoutClient.getHandle().fontRenderer; font.drawString(lwi.getTitle(), x + 2, y + 2, new Color(1.0F, 1.0F, 1.0F).toInt()); font.drawString(lwi.getText(), x + 2, y + 2 + 8, new Color(0.8F, 0.8F, 0.8F).toInt()); }
From source file:org.spoutcraft.client.gui.MCRenderDelegate.java
License:Open Source License
public void render(GenericScrollable gs) { int scrollTop = gs.getScrollPosition(Orientation.VERTICAL); int scrollLeft = gs.getScrollPosition(Orientation.HORIZONTAL); GL11.glTranslated(gs.getScreenX(), gs.getScreenY(), 0); GL11.glEnable(GL11.GL_SCISSOR_TEST); scissorWidget(gs);/*from w w w. j a v a 2 s. co m*/ RenderUtil.drawRectangle(0, 0, (int) gs.getWidth(), (int) gs.getHeight(), gs.getBackgroundColor().toInt()); GL11.glPushMatrix(); GL11.glTranslated(-scrollLeft, -scrollTop, 0); GL11.glPushMatrix(); // Render scrollarea contents gs.renderContents(); GL11.glPopMatrix(); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_SCISSOR_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); // Draw scrollbars if (gs.needsScrollBar(Orientation.HORIZONTAL)) { SpoutClient.getHandle().renderEngine.bindTexture("/gui/allitems.png"); double scrollX = 0; double p = (double) scrollLeft / (double) gs.getMaximumScrollPosition(Orientation.HORIZONTAL); scrollX = 3 + p * (gs.getViewportSize(Orientation.HORIZONTAL) - 16.0 - 6); RenderUtil.drawGradientRectangle(0, (int) gs.getHeight() - 16, (int) gs.getWidth(), (int) gs.getHeight(), scrollBarColor.toInt(), scrollBarColor2.toInt()); GL11.glColor3f(1.0f, 1.0f, 1.0f); RenderUtil.drawTexturedModalRectangle((int) scrollX, (int) (gs.getHeight() - 16), 232, 0, 12, 15, 0f); } if (gs.needsScrollBar(Orientation.VERTICAL)) { SpoutClient.getHandle().renderEngine.bindTexture("/gui/allitems.png"); double scrollY = 0; double p = (double) scrollTop / (double) gs.getMaximumScrollPosition(Orientation.VERTICAL); scrollY = 3 + p * (gs.getViewportSize(Orientation.VERTICAL) - 16.0 - 6); RenderUtil.drawGradientRectangle((int) gs.getWidth() - 16, 0, (int) gs.getWidth(), (int) gs.getHeight(), scrollBarColor.toInt(), scrollBarColor2.toInt()); GL11.glColor3f(1.0f, 1.0f, 1.0f); RenderUtil.drawTexturedModalRectangle((int) (gs.getWidth() - 16), (int) scrollY, 232, 0, 12, 15, 0f); RenderUtil.drawGradientRectangle(0, -1, (int) gs.getWidth(), 5, new Color(0.0F, 0.0F, 0.0F, 1.0F).toInt(), new Color(0.0F, 0.0F, 0.0F, 0.0F).toInt()); RenderUtil.drawGradientRectangle(0, (int) gs.getHeight() - 5, (int) gs.getWidth() + 1, (int) gs.getHeight(), new Color(0.0F, 0.0F, 0.0F, 0.0F).toInt(), new Color(0.0F, 0.0F, 0.0F, 1.0F).toInt()); } }
From source file:org.spoutcraft.client.gui.MCRenderDelegate.java
License:Open Source License
public void renderContents(GenericListWidget lw) { int scrollTop = lw.getScrollPosition(Orientation.VERTICAL); int scrollBottom = (int) (scrollTop + lw.getHeight() + 5); GL11.glTranslated(0, 5, 0); int currentHeight = 0; for (ListWidgetItem item : lw.getItems()) { // Only render visible items if (currentHeight >= scrollTop - item.getHeight() && currentHeight <= scrollBottom) { // Draw selection border if (lw.isSelected(item)) { RenderUtil.drawRectangle(4, currentHeight - 1, lw.getViewportSize(Orientation.HORIZONTAL) - 3, currentHeight - 1 + item.getHeight() + 2, new Color(1.0F, 1.0F, 1.0F).toInt()); RenderUtil.drawRectangle(5, currentHeight, lw.getViewportSize(Orientation.HORIZONTAL) - 4, currentHeight + item.getHeight(), new Color(0.0F, 0.0F, 0.0F).toInt()); }//from www .ja v a2 s .c o m // Render actual item GL11.glPushMatrix(); item.render(5, currentHeight, lw.getViewportSize(Orientation.HORIZONTAL) - 9, item.getHeight()); GL11.glPopMatrix(); } currentHeight += item.getHeight(); } }
From source file:org.spoutcraft.client.gui.MCRenderDelegate.java
License:Open Source License
public void render(GenericComboBox comboBox) { if (comboBox.isVisible()) { comboBox.setInnerWidth((int) comboBox.getWidth() - 16); render((GenericButton) comboBox); Texture text;//w w w . j a v a 2 s . co m if (comboBox.isOpen()) { text = CustomTextureManager.getTextureFromJar("/res/ui/box_ascending.png"); } else { text = CustomTextureManager.getTextureFromJar("/res/ui/box_descending.png"); } GL11.glTranslated(comboBox.getWidth() - 16, 3, 0); RenderUtil.drawRectangle(0, -3, 16, (int) comboBox.getHeight(), 0x33000000); drawTexture(text, 16, 16, getColor(comboBox), true); } }
From source file:org.spoutcraft.client.gui.minimap.MapRenderer.java
License:Open Source License
private void renderEntities() { if (!Spoutcraft.hasPermission("spout.plugin.minimap.showentities")) { return;//w ww .j a v a 2s. c om } if (!MinimapConfig.getInstance().isShowingEntities()) { return; } double playerX = map.getPlayerX(); double playerZ = map.getPlayerZ(); synchronized (map.watchedEntities) { for (WatchedEntity w : map.watchedEntities) { Entity e = w.entity; double entityX = e.posX - playerX; double entityZ = e.posZ - playerZ; boolean render = false; int circleX = MathHelper.floor_double(playerX); int circleY = MathHelper.floor_double(playerZ); if (MinimapConfig.getInstance().isSquare()) { render = Math.abs(playerX - (int) e.posX) < map.renderSize && Math.abs(playerZ - (int) e.posZ) < map.renderSize; } else { render = MinimapUtils.insideCircle(circleX, circleY, map.renderSize / 2, (int) e.posX, (int) e.posZ); } Texture tex = w.getTexture(); if (render && tex != null) { GL11.glPushMatrix(); GL11.glTranslatef(-32.0f, 32.0F, 0.0F); if (!MinimapConfig.getInstance().isSquare()) { GL11.glRotatef((this.direction + 90.0F), 0.0F, 0.0F, 1.0F); } switch (MinimapConfig.getInstance().getZoom()) { case 0: GL11.glTranslated(-entityZ, entityX, 0F); break; case 1: GL11.glTranslated(-entityZ * 0.45F, entityX * 0.45F, 0F); break; case 2: GL11.glTranslated(-entityZ * 0.25F, entityX * 0.28F, 0F); break; case 3: GL11.glTranslated(-entityZ * 0.125F, entityX * 0.125F, 0F); break; } GL11.glScaled(0.05, 0.05, 0.05); GL11.glTranslated(-32f, -32f, 0); GL11.glRotatef(180, 0, 0, 1); if (!MinimapConfig.getInstance().isSquare()) { GL11.glRotatef(-(this.direction + 90f), 0, 0, 1); } tex.bind(); drawOnMap(); GL11.glPopMatrix(); } } } }