Example usage for org.lwjgl.opengl GL11 GL_NEAREST

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

Introduction

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

Prototype

int GL_NEAREST

To view the source code for org.lwjgl.opengl GL11 GL_NEAREST.

Click Source Link

Document

TextureMagFilter

Usage

From source file:org.spout.engine.filesystem.resource.ClientRenderTexture.java

License:Open Source License

@Override
public void writeGPU() {
    if (framebuffer != INVALID_BUFFER) {
        throw new IllegalStateException("Framebuffer already created!");
    }/*w w w  .  j av  a2 s.c  o m*/

    int buffers = 1;

    //Create the color buffer for this renderTexture
    textureID = GL11.glGenTextures();
    SpoutRenderer.checkGLError();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
    SpoutRenderer.checkGLError();

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    SpoutRenderer.checkGLError();
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    SpoutRenderer.checkGLError();
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, width, height, 0, GL11.GL_RGBA, GL11.GL_INT,
            (ByteBuffer) null); // Create the texture data
    SpoutRenderer.checkGLError();

    if (useNormalBuffer) {
        //Create the color buffer for this renderTexture
        normalTarget = GL11.glGenTextures();
        SpoutRenderer.checkGLError();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, normalTarget);
        SpoutRenderer.checkGLError();

        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        SpoutRenderer.checkGLError();
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        SpoutRenderer.checkGLError();
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, width, height, 0, GL11.GL_RGBA,
                GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null); // Create the texture data
        SpoutRenderer.checkGLError();
        buffers++;
    }

    if (useDepthBuffer) {
        //Create the color buffer for this renderTexture
        depthTarget = GL11.glGenTextures();
        SpoutRenderer.checkGLError();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthTarget);
        SpoutRenderer.checkGLError();

        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        SpoutRenderer.checkGLError();
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        SpoutRenderer.checkGLError();
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_DEPTH_COMPONENT, width, height, 0,
                GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null); // Create the texture data
        SpoutRenderer.checkGLError();
        buffers++;
    }

    if (useEXT) {
        framebuffer = EXTFramebufferObject.glGenFramebuffersEXT();
        SpoutRenderer.checkGLError();

        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, framebuffer);
        SpoutRenderer.checkGLError();

        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
        SpoutRenderer.checkGLError();

        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, textureID, 0);
        SpoutRenderer.checkGLError();

        if (useDepthBuffer) {
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthTarget);
            SpoutRenderer.checkGLError();

            EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                    EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, GL11.GL_TEXTURE_2D, depthTarget, 0);
            SpoutRenderer.checkGLError();
        }

        if (useNormalBuffer) {

            GL11.glBindTexture(GL11.GL_TEXTURE_2D, normalTarget);
            SpoutRenderer.checkGLError();

            EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                    EXTFramebufferObject.GL_COLOR_ATTACHMENT1_EXT, GL11.GL_TEXTURE_2D, normalTarget, 0);
            SpoutRenderer.checkGLError();
        }

        if (EXTFramebufferObject.glCheckFramebufferStatusEXT(
                EXTFramebufferObject.GL_FRAMEBUFFER_EXT) != EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT) {
            System.out.println("ERROR: Framebuffer not complete");
            throw new ComputerIsPotatoException("Framebuffer not complete");
        }
        SpoutRenderer.checkGLError();
    } else {
        framebuffer = GL30.glGenFramebuffers();
        SpoutRenderer.checkGLError();

        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer);
        SpoutRenderer.checkGLError();

        IntBuffer drawBuffers = BufferUtils.createIntBuffer(buffers);
        drawBuffers.put(GL30.GL_COLOR_ATTACHMENT0);
        if (useNormalBuffer) {
            drawBuffers.put(GL30.GL_COLOR_ATTACHMENT1);
        }
        drawBuffers.flip();
        GL20.glDrawBuffers(drawBuffers);
        SpoutRenderer.checkGLError();

        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
        SpoutRenderer.checkGLError();

        GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D,
                textureID, 0);
        SpoutRenderer.checkGLError();

        if (useDepthBuffer) {
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthTarget);
            SpoutRenderer.checkGLError();

            GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D,
                    depthTarget, 0);
            SpoutRenderer.checkGLError();
        }
        if (useNormalBuffer) {
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, normalTarget);
            SpoutRenderer.checkGLError();

            GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT1, GL11.GL_TEXTURE_2D,
                    normalTarget, 0);
            SpoutRenderer.checkGLError();
        }

        int status = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);
        if (status != GL30.GL_FRAMEBUFFER_COMPLETE) {
            System.out.println("ERROR: Framebuffer not complete.  Status: " + status);
            throw new ComputerIsPotatoException("Framebuffer not complete");
        }
        SpoutRenderer.checkGLError();

        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, SCREEN_BUFFER);
        SpoutRenderer.checkGLError();
    }
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
    SpoutRenderer.checkGLError();
}

From source file:org.spout.engine.filesystem.resource.ClientTexture.java

License:Open Source License

@Override
public void bind() {
    if (!isLoaded()) {
        throw new IllegalStateException("Cannot bind an unloaded texture!");
    }//from   ww w . jav  a  2  s.c o m
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
    SpoutRenderer.checkGLError();
}

From source file:org.spout.engine.resources.ClientRenderTexture.java

License:Open Source License

@Override
public void writeGPU() {
    if (framebuffer != INVALID_BUFFER)
        throw new IllegalStateException("Framebuffer already created!");

    //Create the color buffer for this renderTexture
    textureID = GL11.glGenTextures();//from   w w w  .j av  a  2 s.  c  om
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, width, height, 0, GL11.GL_RGBA, GL11.GL_INT,
            (java.nio.ByteBuffer) null); // Create the texture data

    if (useEXT) {
        framebuffer = EXTFramebufferObject.glGenFramebuffersEXT();

        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, framebuffer);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);

        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, textureID, 0);

        if (useDepthBuffer) {
            depthTarget = GL30.glGenRenderbuffers();
            EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, depthTarget);
            EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                    GL11.GL_DEPTH_COMPONENT, this.getWidth(), this.getHeight());
            EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                    GL30.GL_DEPTH_ATTACHMENT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, depthTarget);
        }

        if (EXTFramebufferObject.glCheckFramebufferStatusEXT(
                EXTFramebufferObject.GL_FRAMEBUFFER_EXT) != EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT) {
            System.out.println("ERROR: Framebuffer not complete");
            throw new ComputerIsPotatoException("Framebuffer not complete");
        }

    } else {
        framebuffer = GL30.glGenFramebuffers();
        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);

        GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D,
                textureID, 0);

        if (useDepthBuffer) {
            depthTarget = GL30.glGenRenderbuffers();
            GL30.glBindRenderbuffer(GL30.GL_RENDERBUFFER, depthTarget);
            GL30.glRenderbufferStorage(GL30.GL_RENDERBUFFER, GL11.GL_DEPTH_COMPONENT, this.getWidth(),
                    this.getHeight());
            GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL30.GL_RENDERBUFFER,
                    depthTarget);
        }
        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, SCREEN_BUFFER);

        if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE) {
            System.out.println("ERROR: Framebuffer not complete");
            throw new ComputerIsPotatoException("Framebuffer not complete");
        }

    }
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

}

From source file:org.spoutcraft.api.gui.renderer.GuiRendererFBO.java

License:MIT License

public GuiRendererFBO() {
    this.guiTex = GL11.glGenTextures();
    TextureUtil.bind(guiTex);//from   ww w .j  a va 2s  .c  o  m
    TextureUtil.setMinFilter(GL11.GL_NEAREST);
    TextureUtil.setMagFilter(GL11.GL_NEAREST);
    TextureUtil.bind(0);

    this.stencilBuff = GL30.glGenRenderbuffers();
    this.fbo = GL30.glGenFramebuffers();
}

From source file:org.spoutcraft.client.config.MipMapUtils.java

License:Open Source License

public static void update(int texture) {
    GL11.glPushMatrix();/*from  w w  w . j  ava2  s .c o m*/
    if (MipMapUtils.mode == 3) {
        MipMapUtils.updateTerrain = Configuration.getMipmapsPercent() > 0F;
        SpoutClient.getHandle().renderEngine.bindTexture(texture);
        if (Configuration.getMipmapsPercent() > 0F) {
            GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR);
        } else {
            GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        }
        GL11.glPopMatrix();
        return;
    }

    if (Configuration.getMipmapsPercent() > 0F) {
        MipMapUtils.updateTerrain = true;
        SpoutClient.getHandle().renderEngine.bindTexture(texture);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR);
    }
    GL11.glPopMatrix();
}

From source file:org.spoutcraft.client.config.MipMapUtils.java

License:Open Source License

public static void onTick(int texture, float targetFade, float currentFade) {
    GL11.glPushMatrix();//from  ww w  .j  a v a2 s .co  m
    SpoutClient.getHandle().renderEngine.bindTexture(texture);

    if (targetFade != currentFade) {
        if (targetFade < currentFade) {
            currentFade -= 0.01f;
            if (currentFade <= targetFade) {
                currentFade = targetFade;
            }
        } else {
            currentFade += 0.01f;
            if (currentFade >= targetFade) {
                currentFade = targetFade;
            }
        }

        if (currentFade <= 0.0f) {
            GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.01F); // Default blend state

            updateTerrain = false;
            GL11.glPopMatrix();
            return;
        } else {
            GL11.glTexEnvf(GL14.GL_TEXTURE_FILTER_CONTROL, GL14.GL_TEXTURE_LOD_BIAS,
                    getMipmapLevels(texture) * (currentFade - 1.0f));
        }
    }

    switch (mode) {
    case 1:
        GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
        break;
    case 2:
        EXTFramebufferObject.glGenerateMipmapEXT(GL11.GL_TEXTURE_2D);
        break;
    }
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.3F); // More strict blend state
    GL11.glPopMatrix();
}

From source file:org.spoutcraft.client.gui.about.GuiAbout.java

License:Open Source License

@Override
public void drawScreen(int x, int y, float z) {
    super.drawBackground(0);
    GL11.glPushMatrix();/*from  ww w  . j a  v a 2s.  c  o m*/

    GL11.glDisable(2896 /*GL_LIGHTING*/);
    GL11.glDisable(2912 /*GL_FOG*/);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bg.setTopColor(background1);
    bg.setBottomColor(background2);
    bg.setY(30);
    bg.setHeight(this.height - 50);
    bg.setX(0);
    bg.setWidth(this.width - 12);
    bg.render();

    scrollArea.setY(30);
    scrollArea.setHeight(this.height - 50);
    scrollArea.setX(this.width - 12);
    scrollArea.setWidth(16);
    scrollArea.setTopColor(scrollBarColor);
    scrollArea.setBottomColor(scrollBarColor2);
    scrollArea.render();

    // Right half
    int top = 0;
    drawScaledString("What is Spoutcraft?", this.width / 2 - 200, top, 0xffffff);
    top += 10;
    drawScaledString("Spoutcraft is a modification for the", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Minecraft client that plays exactly", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("like the official game. Its goal is", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("to give developers an easy to use", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("platform for building and distributing", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("mods, while providing a rich", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("gameplay experience for users.", this.width / 2 - 200, top, 0x808080);
    top += 10;

    top += 20;

    drawScaledString("What is Spout?", this.width / 2 - 200, top, 0xffffff);
    top += 10;
    drawScaledString("Spout is a Bukkit plugin development", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("platform that allows for previously", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("impossible tasks, such as custom items", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("blocks, mobs, animals, and vehicles. ", this.width / 2 - 200, top, 0x808080);
    top += 10;

    top += 20;

    drawScaledString("Who is SpoutDev?", this.width / 2 - 200, top, 0xffffff);
    top += 10;
    drawScaledString("SpoutDev is the team behind Spout, ", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("SpoutAPI, Spoutcraft,", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("and Spoutcraft Launcher.", this.width / 2 - 200, top, 0x808080);
    top += 10;

    top += 20;

    drawScaledString("Contributors", this.width / 2 - 200, top, 0xffffff);
    top += 10;
    drawScaledString("The Bukkit Team - Bukkit Server API", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("lahwran - Fast Events Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("lahwran - Minimap Logic", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Celtic Minstrel - Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Zeerix - Threading Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Karlthepagan - OptiTick Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Kahr - HD Textures Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Jeckari - Custom Texture Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Rycochet - GUI Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("knowbuddy - GUI Optimizations", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("TomyLobo - Mipmapping Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Apache Foundation - Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("ThVortex - FontRenderer fixes", this.width / 2 - 200, top, 0x808080);
    top += 10;

    // Left half
    top = 0;
    drawScaledString("Sponsors", this.width / 2 + 30, top, 0xffffff);
    top += 10;

    top = 130;

    drawScaledString("Team", this.width / 2 + 30, top, 0xffffff);
    top += 10;
    drawScaledString("Afforess - Lead Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Wulfspider - Co-Lead & Support", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("alta189 - Co-Lead & Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Top_Cat - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("raphfrk - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("narrowtux - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Olloth - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Rycochet - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("RoyAwesome - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("zml2008 - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Zidane - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;

    top += 20;

    drawScaledString("Contact", this.width / 2 + 30, top, 0xffffff);
    top += 10;
    drawScaledString("Email: dev@spout.org", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Website: spout.org", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("#spout on irc.esper.net", this.width / 2 + 30, top, 0x808080);
    top += 10;

    top += 20;

    drawScaledString("Note", this.width / 2 + 30, top, 0xffffff);
    top += 10;
    drawScaledString("Spoutcraft, Spout, and related", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("projects are open source. You", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("can browse the source code at", this.width / 2 + 30, top, 0x808080);
    top += 10;
    sourceY = top;
    sourceWidth = this.fontRenderer.getStringWidth("https://github.com/SpoutDev");
    drawScaledString("https://github.com/SpoutDev", this.width / 2 + 30, sourceY,
            hoveringLink ? 0x65A5D1 : 0x176093);
    top += 10;

    top += 20;

    int beastNodeX = (this.width / 2 + 30);
    int beastNodeY = getScaledHeight(15);
    if (beastNodeLogo != null) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDepthMask(false);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef(beastNodeX, beastNodeY, 0); // Moves texture into place
        SpoutClient.getHandle().renderEngine.bindTexture(beastNodeLogo.getTextureID());
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        Tessellator tessellator = Tessellator.instance;
        //GL11.glScalef(0.5f, 0.5f, 0.5f);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, 33, -90, 0.0D, 0.0D); // Draw corners
        tessellator.addVertexWithUV(147, 33, -90, beastNodeLogo.getWidth(), 0.0D);
        tessellator.addVertexWithUV(147, 0.0D, -90, beastNodeLogo.getWidth(), beastNodeLogo.getHeight());
        tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, beastNodeLogo.getHeight());
        tessellator.draw();
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }

    int minecraftBizX = (this.width / 2 + 30);
    int minecraftBizY = getScaledHeight(85);
    if (minecraftBizLogo != null) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDepthMask(false);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef(minecraftBizX, minecraftBizY, 0); // Moves texture into place
        SpoutClient.getHandle().renderEngine.bindTexture(minecraftBizLogo.getTextureID());
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        Tessellator tessellator = Tessellator.instance;
        //GL11.glScalef(0.5f, 0.5f, 0.5f);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, 33, -90, 0.0D, 0.0D); // Draw corners
        tessellator.addVertexWithUV(147, 33, -90, minecraftBizLogo.getWidth(), 0.0D);
        tessellator.addVertexWithUV(147, 0.0D, -90, minecraftBizLogo.getWidth(), minecraftBizLogo.getHeight());
        tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, minecraftBizLogo.getHeight());
        tessellator.draw();
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }

    // Draw tooltips
    if (isInBoundingRect(beastNodeX, beastNodeY, 33, 147, x, y)) {
        drawTooltip("BeastNode provides high quality Minecraft and web hosting at affordable\n"
                + "prices and is generously sponsoring the Spout project with its hosting\n"
                + "& server needs. Mine, build, craft, and chat with your own high quality\n"
                + "Minecraft server with FREE mumble voice server and web hosting.", x, y);
    } else if (isInBoundingRect(minecraftBizX, minecraftBizY, 33, 147, x, y)) {
        drawTooltip("Your Minecraft community in a new dimension!", x, y);
    }

    GL11.glDisable(2896 /*GL_LIGHTING*/);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    SpoutClient.getHandle().renderEngine.bindTexture("/gui/gui.png");
    RenderUtil.drawTexturedModalRectangle(this.width - 14, getInvertedScaledHeight(this.height), 0, 208, 16, 16,
            0f);

    GL11.glDisable(2912 /*GL_FOG*/);
    GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
    this.overlayBackground(0, 30, 255, 255);
    this.overlayBackground(this.height - 50, this.height, 255, 255);
    drawCenteredString(this.fontRenderer, "About", this.width / 2, 16, 0xffffff);
    SpoutClient.getHandle().renderEngine.bindTexture("/title/mclogo.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPushMatrix();
    GL11.glTranslatef((0.0325f * this.width), (this.height - 40), 0);
    GL11.glScalef(0.4f, 0.4f, 0.4f);
    this.drawTexturedModalRect(0, 0, 0, 0, 155, 44);
    this.drawTexturedModalRect(155, 0, 0, 45, 155, 44);
    GL11.glPopMatrix();

    if (spoutcraftTexture != null) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(false);
        GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((this.width - 140), (this.height - 45), 0); // Moves texture into place
        SpoutClient.getHandle().renderEngine.bindTexture(spoutcraftTexture.getTextureID());
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, 32, -90, 0.0D, 0.0D); // Draw corners
        tessellator.addVertexWithUV(128, 32, -90, spoutcraftTexture.getWidth(), 0.0D);
        tessellator.addVertexWithUV(128, 0.0D, -90, spoutcraftTexture.getWidth(),
                spoutcraftTexture.getHeight());
        tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, spoutcraftTexture.getHeight());
        tessellator.draw();
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }

    drawString(this.fontRenderer, "Unknown Version", (int) (this.width * 0.034f), this.height - 20, 0xffffff);
    drawString(this.fontRenderer, "Copyright Mojang AB", (int) (this.width * 0.034f), this.height - 10,
            0x808080);

    String version = SpoutClient.getClientVersion();
    drawString(this.fontRenderer, version,
            (int) (this.width - 45) - fontRenderer.getStringWidth(version) + fontRenderer.getStringWidth("0"),
            this.height - 20, 0xffffff);
    drawString(this.fontRenderer, "Licensed under LGPLv3", (int) (this.width - 129), this.height - 10,
            0x808080);

    ((GuiButton) this.buttonList.get(0)).xPosition = this.width / 2 - 50;
    ((GuiButton) this.buttonList.get(0)).yPosition = this.height - 25;
    ((GuiButton) this.buttonList.get(0)).drawButton(this.mc, x, y);
    //super.drawScreen(x, x, z);

    // Shadow magic
    GL11.glEnable(3042 /*GL_BLEND*/);
    GL11.glBlendFunc(770, 771);
    GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
    GL11.glShadeModel(7425 /*GL_SMOOTH*/);
    GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
    Tessellator var16 = Tessellator.instance;
    byte var19 = 4;
    var16.startDrawingQuads();
    var16.setColorRGBA_I(0, 0);
    var16.addVertexWithUV(0, (double) (30 + var19), 0.0D, 0.0D, 1.0D);
    var16.addVertexWithUV(this.width - 12, (double) (30 + var19), 0.0D, 1.0D, 1.0D);
    var16.setColorRGBA_I(0, 255);
    var16.addVertexWithUV(this.width - 12, 30, 0.0D, 1.0D, 0.0D);
    var16.addVertexWithUV(0, 30, 0.0D, 0.0D, 0.0D);
    var16.draw();
    var16.startDrawingQuads();
    var16.setColorRGBA_I(0, 255);
    var16.addVertexWithUV(0, this.height - 50, 0.0D, 0.0D, 1.0D);
    var16.addVertexWithUV(this.width - 12, this.height - 50, 0.0D, 1.0D, 1.0D);
    var16.setColorRGBA_I(0, 0);
    var16.addVertexWithUV(this.width - 12, (double) (this.height - 50 - var19), 0.0D, 1.0D, 0.0D);
    var16.addVertexWithUV(0, (double) (this.height - 50 - var19), 0.0D, 0.0D, 0.0D);
    var16.draw();

    GL11.glEnable(3008 /*GL_ALPHA_TEST*/);

    GL11.glPopMatrix();
}

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;/*from  w ww.  j a v a 2 s .  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(GenericBitmap bitmap) {
    int textureId;
    if (bitmapId.containsKey(bitmap)) {
        textureId = bitmapId.get(bitmap);
    } else {//from   w ww .  j a v a2  s  .  com
        IntBuffer tmp = IntBuffer.allocate(1);
        GL11.glGenTextures(tmp);
        textureId = tmp.get(0);
        bitmapId.put(bitmap, textureId);
    }
    int width = (int) bitmap.getActualWidth();
    int height = (int) bitmap.getActualHeight();
    int left = bitmap.getLeft();
    int top = bitmap.getTop();
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, bitmap.getRawWidth(), bitmap.getRawHeight(), 0,
            GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, bitmap.getBuffer());
    GL11.glTranslatef((float) bitmap.getScreenX(), (float) bitmap.getScreenY(), 0); // moves texture into place
    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(770, 771);
    GL11.glDepthMask(false);
    bindColor(new Color(1.0F, 1.0F, 1.0F));
    SpoutClient.getHandle().renderEngine.bindTexture(textureId);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    double tLeft = 0, tTop = 0, rWidth = bitmap.getWidth(), rHeight = bitmap.getHeight(), tWidth = rWidth,
            tHeight = rHeight;
    if (top >= 0 && left >= 0) {
        tWidth = Math.min(tWidth, width);
        tHeight = Math.min(tHeight, height);
        tLeft = Math.min(Math.max(0, left), rWidth);
        tTop = Math.min(Math.max(0, top), rHeight);
    }
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(0.0D, height, -90, tLeft, tTop); // draw corners
    tessellator.addVertexWithUV(width, height, -90, tWidth, tTop);
    tessellator.addVertexWithUV(width, 0.0D, -90, tWidth, tHeight);
    tessellator.addVertexWithUV(0.0D, 0.0D, -90, tLeft, tHeight);
    tessellator.draw();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_BLEND);
}

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

License:Open Source License

public void drawTexture(Texture textureBinding, int width, int height, Color color, boolean blend, int left,
        int top, boolean mipmap) {
    drawTexture(textureBinding, width, height, color, blend, left, top, mipmap, GL11.GL_NEAREST);
}