Example usage for org.lwjgl.opengl GL11 glScaled

List of usage examples for org.lwjgl.opengl GL11 glScaled

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glScaled.

Prototype

public static native void glScaled(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glScalef Scalef .

Usage

From source file:org.cogaen.lwjgl.scene.TextVisual.java

License:Open Source License

@Override
public void render() {
    GL11.glPushMatrix();// w w w  .ja  va  2 s  .  c  o  m
    GL11.glScaled(getScale(), -getScale(), 1);

    org.newdawn.slick.Color utilColor = new org.newdawn.slick.Color((int) (getColor().getRed() * 255),
            (int) (getColor().getGreen() * 255), (int) (getColor().getBlue() * 255),
            (int) (getColor().getAlpha() * 255));

    switch (this.alignment) {
    case LEFT:
        this.ttf.drawString(0, -this.ttf.getHeight() / 2.0f, this.text, utilColor);
        break;

    case CENTER:
        this.ttf.drawString(-this.ttf.getWidth(this.text) / 2, -this.ttf.getHeight() / 2.0f, this.text,
                utilColor);
        break;

    case RIGHT:
        this.ttf.drawString(-this.ttf.getWidth(this.text), -this.ttf.getHeight() / 2.0f, this.text, utilColor);
        break;
    }
    GL11.glPopMatrix();
}

From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java

License:Open Source License

@Override
public void dsDrawSphere(final float[] pos, final float[] R, float radius) {
    if (current_state != 2)
        dsError("drawing function called outside simulation loop");
    setupDrawingMode();//  w  w w.j  a v  a 2s.  c om
    GL11.glEnable(GL11.GL_NORMALIZE);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    setTransform(pos, R);
    GL11.glScaled(radius, radius, radius);
    drawSphere();
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_NORMALIZE);

    // draw shadows
    if (use_shadows) {
        GL11.glDisable(GL11.GL_LIGHTING);
        if (use_textures) {
            ground_texture.bind(true);
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
            GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
            GL11.glColor3f(SHADOW_INTENSITY, SHADOW_INTENSITY, SHADOW_INTENSITY);
        } else {
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            GL11.glColor3f(GROUND_R * SHADOW_INTENSITY, GROUND_G * SHADOW_INTENSITY,
                    GROUND_B * SHADOW_INTENSITY);
        }
        GL11.glShadeModel(GL11.GL_FLAT);
        GL11.glDepthRange(0, 0.9999);
        drawSphereShadow(pos[0], pos[1], pos[2], radius);
        GL11.glDepthRange(0, 1);
    }
}

From source file:org.spoutcraft.client.gui.mainmenu.MainMenu.java

License:Open Source License

private void animate(org.newdawn.slick.opengl.Texture tex) {
    int adjustedX = ((100 - HEIGHT_PERCENT) / 2) * tex.getImageHeight() * panTime;
    adjustedX /= maxPanTime;//w  w  w  .j ava  2s. c o m
    adjustedX /= 100;

    int adjustedY = ((100 - WIDTH_PERCENT) / 2) * tex.getImageWidth() * panTime;
    adjustedY /= maxPanTime;
    adjustedY /= 100;

    int adjustedHeight = tex.getImageHeight() - adjustedX;

    int adjustedWidth = tex.getImageWidth() - adjustedY;

    GL11.glScaled(this.getActualWidth() / (adjustedWidth - adjustedX),
            this.getActualHeight() / (adjustedHeight - adjustedY), 1D);
    GL11.glTranslatef(-adjustedX, -adjustedY, 0F);
    ((MCRenderDelegate) Spoutcraft.getRenderDelegate()).drawTexture(tex, adjustedWidth, adjustedHeight, white,
            false, -1, -1, Configuration.getMainMenuState() == 1, GL11.GL_NEAREST);

    if (zoomIn && panTime < maxPanTime) {
        panTime++;
    } else if (!zoomIn && panTime > 0) {
        panTime--;
    } else {
        cycleBackground();
    }
}

From source file:org.spoutcraft.client.gui.MCRenderDelegate.java

License:Open Source License

public void render(GenericItemWidget item) {
    GL11.glDepthFunc(515);/*from   w  w w.j a  v  a  2 s  .com*/
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) item.getScreenX(), (float) item.getScreenY(), 0);
    if (item.getAnchor() == WidgetAnchor.SCALE) {
        GL11.glScalef((float) (item.getScreen().getWidth() / 427f),
                (float) (item.getScreen().getHeight() / 240f), 1);
    }
    GL11.glScaled(item.getWidth() / 16D, item.getHeight() / 16D, 1);
    int id = item.getTypeId();
    int data = item.getData();
    if (MaterialData.getCustomItem(id) != null) {
        int temp = id;
        id = 318;
        data = temp;
    }
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    renderer.renderItemIntoGUI(SpoutClient.getHandle().fontRenderer, SpoutClient.getHandle().renderEngine,
            new net.minecraft.src.ItemStack(id, 1, data), 0, 0);
    GL11.glPopMatrix();
    GL11.glScaled(16D / item.getWidth(), 16D / item.getHeight(), 1);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    RenderHelper.disableStandardItemLighting();
}

From source file:org.spoutcraft.client.gui.MCRenderDelegate.java

License:Open Source License

public void render(GenericSlot genericSlot) {
    if (!genericSlot.isVisible()) {
        return;//w w w .  ja  v a2 s  .  c o  m
    }
    ItemStack item = genericSlot.getItem();

    GL11.glDepthFunc(515);
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) genericSlot.getScreenX(), (float) genericSlot.getScreenY(), 0);
    if (genericSlot.getAnchor() == WidgetAnchor.SCALE) {
        GL11.glScalef((float) (genericSlot.getScreen().getWidth() / 427f),
                (float) (genericSlot.getScreen().getHeight() / 240f), 1);
    }
    GL11.glScaled(genericSlot.getWidth() / 16D, genericSlot.getHeight() / 16D, 1);

    if (item.getTypeId() != 0) {
        GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        int id = item.getTypeId();
        int data = item.getDurability();
        if (MaterialData.getCustomItem(id) != null) {
            int temp = id;
            id = 318;
            data = temp;
        }
        renderer.renderItemIntoGUI(SpoutClient.getHandle().fontRenderer, SpoutClient.getHandle().renderEngine,
                new net.minecraft.src.ItemStack(id, item.getAmount(), data), 0, 0);
        renderer.renderItemOverlayIntoGUI(SpoutClient.getHandle().fontRenderer,
                SpoutClient.getHandle().renderEngine,
                new net.minecraft.src.ItemStack(id, item.getAmount(), data), 0, 0);
    }
    GL11.glEnable(GL11.GL_LIGHTING);
    RenderHelper.disableStandardItemLighting();
    if (isHovering(genericSlot))
        RenderUtil.drawRectangle(0, 0, 16, 16, 0x88ffffff);
    GL11.glPopMatrix();
}

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;/*from   w ww  . j  a  v a 2  s .c  o  m*/
    }
    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();
            }
        }
    }
}

From source file:org.spoutcraft.client.gui.minimap.MapRenderer.java

License:Open Source License

private void drawRound() {
    try {/*from www. ja v  a 2  s. c  o  m*/
        GL11.glPushMatrix();
        if (MinimapConfig.getInstance().isShowBackground()) {
            texman.loadRoundmap();
        } else {
            GL11.glScaled(0.95F, 0.95F, 1F);
            GL11.glTranslatef(-2F, 2F, 0);
            texman.loadWhiteRoundmap();
        }
        drawOnMap();
    } catch (Exception localException) {
        //         System.err.println("Error: minimap overlay not found!");
    } finally {
        GL11.glPopMatrix();
    }
}

From source file:org.spoutcraft.client.gui.minimap.MapWidget.java

License:Open Source License

@Override
public void renderContents() {
    GL11.glDisable(2929);//www  .ja  v  a  2 s  .com
    GL11.glEnable(3042);
    GL11.glDepthMask(false);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    int scrollX = (int) (getScrollPosition(Orientation.HORIZONTAL) / scale);
    int scrollY = (int) (getScrollPosition(Orientation.VERTICAL) / scale);

    GL11.glScaled(scale, scale, scale);
    GL11.glTranslatef(-heightMap.getMinX() * 16, -heightMap.getMinZ() * 16, 0);

    int minChunkX = heightMap.getMinX() + scrollX / 16, minChunkZ = heightMap.getMinZ() + scrollY / 16,
            maxChunkX = 0, maxChunkZ = 0;
    int horiz = (int) (getWidth() / 16 / scale) + 1;
    int vert = (int) (getHeight() / 16 / scale) + 1;
    maxChunkX = minChunkX + horiz;
    maxChunkZ = minChunkZ + vert;

    minChunkX = Math.max(minChunkX, heightMap.getMinX());
    minChunkZ = Math.max(minChunkZ, heightMap.getMinZ());
    maxChunkX = Math.min(maxChunkX, heightMap.getMaxX());
    maxChunkZ = Math.min(maxChunkZ, heightMap.getMaxZ());

    GL11.glPushMatrix();
    synchronized (chunks) {
        for (int chunkX = minChunkX; chunkX <= maxChunkX; chunkX += levelOfDetail) {
            for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; chunkZ += levelOfDetail) {
                Map map = getChunkMap(levelOfDetail).get(chunkX, chunkZ);
                if (dirty || map == null || random.nextInt(10000) == 0) {
                    renderer.renderQueue.add(new Point(chunkX, chunkZ));
                }
                if (map != null && map != blankMap) {
                    GL11.glPushMatrix();
                    int x = chunkX * 16;
                    int y = chunkZ * 16;
                    int width = x + 16 * levelOfDetail;
                    int height = y + 16 * levelOfDetail;
                    map.loadColorImage();
                    MinecraftTessellator tessellator = Spoutcraft.getTessellator();
                    tessellator.startDrawingQuads();
                    tessellator.addVertexWithUV((double) width, (double) height, -90, 1, 1);
                    tessellator.addVertexWithUV((double) width, (double) y, -90, 1, 0);
                    tessellator.addVertexWithUV((double) x, (double) y, -90, 0, 0);
                    tessellator.addVertexWithUV((double) x, (double) height, -90, 0, 1);
                    tessellator.draw();
                    //               GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                    //               RenderUtil.drawRectangle(x, y, width, height, 0x88ffffff);
                    if (MinimapConfig.getInstance().isHeightmap()) {
                        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_COLOR);
                        map.loadHeightImage();
                        tessellator.startDrawingQuads();
                        tessellator.addVertexWithUV((double) width, (double) height, -90, 1, 1);
                        tessellator.addVertexWithUV((double) width, (double) y, -90, 1, 0);
                        tessellator.addVertexWithUV((double) x, (double) y, -90, 0, 0);
                        tessellator.addVertexWithUV((double) x, (double) height, -90, 0, 1);
                        tessellator.draw();
                    }
                    GL11.glPopMatrix();
                }
            }
        }
    }
    int x = (int) SpoutClient.getHandle().thePlayer.posX;
    int z = (int) SpoutClient.getHandle().thePlayer.posZ;

    drawPOI("You", x, z, 0xffff0000);

    for (Waypoint waypoint : MinimapConfig.getInstance().getAllWaypoints(MinimapUtils.getWorldName())) {
        if (!waypoint.deathpoint || MinimapConfig.getInstance().isDeathpoints()) {
            drawPOI(waypoint.name, waypoint.x, waypoint.z, 0xff00ff00);
        }
    }

    if (MinimapConfig.getInstance().getFocussedWaypoint() != null) {
        Waypoint pos = MinimapConfig.getInstance().getFocussedWaypoint();
        drawPOI("Marker", pos.x, pos.z, 0xff00ffff);
    }

    GL11.glPopMatrix();
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glEnable(2929);
    GL11.glDisable(3042);
    dirty = false;

    Point newpos = getPlayerPosition();
    if (lastPlayerPos.getX() != newpos.getX() || lastPlayerPos.getY() != newpos.getY()) {
        showPlayer(0);
        lastPlayerPos = newpos;
    }
}

From source file:pixlepix.auracascade.lexicon.page.PageImage.java

License:Creative Commons License

@Override
@SideOnly(Side.CLIENT)//from w  ww .  ja va  2  s.c o  m
public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
    TextureManager render = Minecraft.getMinecraft().renderEngine;
    render.bindTexture(resource);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslated(gui.getLeft() + gui.getWidth() / 8, gui.getTop() + gui.getHeight() / 8, 0);
    GL11.glScaled(.5, .5, .5);
    ((GuiScreen) gui).drawTexturedModalRect(0, 0, 0, 0, (int) (gui.getWidth() * 1.5) + 5,
            (int) (gui.getHeight() * 1.5) - 15);
    GL11.glDisable(GL11.GL_BLEND);

    int width = gui.getWidth() - 30;
    int height = gui.getHeight();
    int x = gui.getLeft() + 16;
    int y = gui.getTop() + height - 40;
    //PageText.renderText(x, y, width, height, getUnlocalizedName());
}

From source file:rainwarrior.mt100.client.TileEntityMT100Renderer.java

License:Open Source License

public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTick) {
    TileEntityMT100 te = (TileEntityMT100) tile;
    if (te == null)
        return;//from   ww w. j  a  va2 s  .c  o m
    GL11.glColor4f(0F, 0F, 0F, 0F);
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    GL11.glScaled(-1D / 16D, -1D / 16D, -1D / 16D);
    GL11.glTranslatef(-15, -14, 0);
    if (te.backlight) {
        OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glColor4f(0F, 0F, 0F, 0F);
        OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    }
    RenderHelper.disableStandardItemLighting();
    te.screen.render(14, 12);
    if (te.backlight) {
        OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    }
    GL11.glTranslatef(7, 6, -8);
    Tessellator tes = Tessellator.instance;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    tes.startDrawingQuads();
    tes.setColorRGBA(0xB4, 0x8E, 0x4F, 0xFF);
    int w1 = 6;
    int w2 = 3;
    addSquareZ(tes, -7, 8, 8, 6, 8);
    addSquareZ(tes, 7, 8, 6, -8, 8);
    addSquareZ(tes, -8, 7, -6, -8, 8);
    addSquareZ(tes, -8, -7, 8, -6, 8);

    addSquareZ(tes, -w1, 8, w1, 8, w2);
    addSquareZ(tes, w1, 8, -8, w1, w2);
    addSquareZ(tes, -8, w1, -8, -w1, w2);
    addSquareZ(tes, -8, -w1, -w1, 8, w2);

    addSquareZ(tes, -w1, w1, -w1, w1, -8);

    addSquareX(tes, -8, -8, 8, w2, 8);
    addSquareX(tes, 8, 8, -8, w2, 8);
    addSquareY(tes, -8, 8, -8, w2, 8);
    addSquareY(tes, 8, -8, 8, w2, 8);

    addSquareX(tes, -w1, -w1, w1, -8, w2);
    addSquareX(tes, w1, w1, -w1, -8, w2);
    addSquareY(tes, -w1, w1, -w1, -8, w2);
    addSquareY(tes, w1, -w1, w1, -8, w2);

    tes.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    RenderHelper.enableStandardItemLighting();
    GL11.glPopMatrix();
}