Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8431729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:56:02+00:00 2026-06-10T05:56:02+00:00

I am using the slick-util library to load textures for the lwjgl library. I

  • 0

I am using the slick-util library to load textures for the lwjgl library. I have created three ‘Texture’ variables [topTex, sideTex, bottomTex] and loaded them with three different pictures. After looking at different possibilities, I don’t know what the problem might be. I keep getting the last image in every single one of my variables;

private static double WIDTH = 1920;
private static double HEIGHT = 1080;
private static double DEPTH = 1200;
private static double SPEED = 1;

private double posx = WIDTH / 2;
private double posy = HEIGHT / 2;
private double posz = DEPTH / 2;
private double rotx = 0;
private double roty = 0;
private double rotz = 0;

private Texture topTex;
private Texture sideTex;
private Texture bottomTex;

public static void main(String[] args) {

    Program program = new Program();
    program.start();
}
private void start() {

    try {

        if (WIDTH == Toolkit.getDefaultToolkit().getScreenSize().width && HEIGHT == Toolkit.getDefaultToolkit().getScreenSize().height) { Display.setFullscreen(true); }
        else { Display.setDisplayMode(new DisplayMode((int)WIDTH, (int)HEIGHT)); }
        Display.setTitle("LWJGL Minecraft Logo");
        Display.create();
    }
    catch (LWJGLException e) {

        e.printStackTrace();
        System.exit(0);
    }

    this.initGL11();
    this.loadTop();
    this.loadSide();
    this.loadBottom();

    while (!Display.isCloseRequested()) {

        this.pollInput();
        this.render();
        Display.update();
    }

    Display.destroy();
}
private void initGL11() {

    GL11.glEnable(GL11.GL_TEXTURE_2D);               
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);          
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glViewport(0, 0, (int)WIDTH, (int)HEIGHT);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, WIDTH, HEIGHT, 0, 0, -DEPTH);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}
private void loadTop() { 

    try {

        topTex = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/topTex.png"));
    }
    catch (IOException e) {

        e.printStackTrace();
        System.exit(0);
    }
}
private void loadSide() {

    try {

        sideTex = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/sideTex.png"));
    }
    catch (IOException e) {

        e.printStackTrace();
        System.exit(0);
    }
}
private void loadBottom() {

    try {

        bottomTex = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/bottomTex.png"));
    }
    catch (IOException e) {

        e.printStackTrace();
        System.exit(0);
    }
}
private void pollInput() {

    if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { System.exit(0); }
    if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {

        posx = WIDTH / 2;
        posy = HEIGHT / 2;
        posz = DEPTH / 2;
        rotx = 0;
        roty = 0;
        rotz = 0;
    }

    if (Keyboard.isKeyDown(Keyboard.KEY_W)) { posy = posy + SPEED; }
    if (Keyboard.isKeyDown(Keyboard.KEY_A)) { posx = posx - SPEED; }
    if (Keyboard.isKeyDown(Keyboard.KEY_S)) { posy = posy - SPEED; }
    if (Keyboard.isKeyDown(Keyboard.KEY_D)) { posx = posx + SPEED; }
    if (Keyboard.isKeyDown(Keyboard.KEY_Q)) { posz = posz - SPEED; }
    if (Keyboard.isKeyDown(Keyboard.KEY_E)) { posz = posz + SPEED; }

    if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { rotx = rotx + SPEED / 2; }
    if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { roty = roty + SPEED / 2; }
    if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { rotz = rotz + SPEED / 2; }
    }
private void render() {

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    Color.white.bind();

    GL11.glPushMatrix();

        GL11.glTranslated(posx, posy, posz);
        GL11.glRotated(rotx, 1, 0, 0);
        GL11.glRotated(roty, 0, 1, 0);
        GL11.glRotated(rotz, 0, 0, 1);
        GL11.glTranslated(-posx, -posy, -posz);

        GL11.glBegin(GL11.GL_QUADS);

            topTex.bind();
            GL11.glTexCoord2d(0, 0);
            GL11.glVertex3d(posx - 16, posy - 16, posz - 16);
            GL11.glTexCoord2d(1, 0);
            GL11.glVertex3d(posx + 16, posy - 16, posz - 16);
            GL11.glTexCoord2d(1, 1);
            GL11.glVertex3d(posx + 16, posy + 16, posz - 16);
            GL11.glTexCoord2d(0, 1);
            GL11.glVertex3d(posx - 16, posy + 16, posz - 16);
            topTex.release();

            sideTex.bind();
            GL11.glTexCoord2d(0, 0);
            GL11.glVertex3d(posx + 16, posy - 16, posz - 16);
            GL11.glTexCoord2d(1, 0);
            GL11.glVertex3d(posx + 16, posy - 16, posz + 16);
            GL11.glTexCoord2d(1, 1);
            GL11.glVertex3d(posx + 16, posy + 16, posz + 16);
            GL11.glTexCoord2d(0, 1);
            GL11.glVertex3d(posx + 16, posy + 16, posz - 16);
            sideTex.release();

        GL11.glEnd();

     GL11.glPopMatrix();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:56:04+00:00Added an answer on June 10, 2026 at 5:56 am

    I’m very new to LWJGL but I believe the call to Texture.bind needs to be before the call to glBegin. You’ll need a glBegin/glEnd pair for each texture.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Slick Util's Texture class to load textures for lwjgl, but apparently that
I'm using LWJGL and Slick framework to load Textures to my OpenGL-application. I'm using
I have a java game using lwjgl and slick-util. It works perfectly on my
Is it possible to load PNG Textures and draw Strings in LWJGL WITHOUT using
I have a filter on slick grid header. When I hide a column using
I'm creating an app using the very slick KnockoutJS library, but I've run into
How to export to runnable java file with eclipse using slick and lwjgl (Light
For a slick UI, I am deciding between using a client side library (
Does anyone have a slick way of adding filler dots to a table of
Is there a way to select all elements that have a given style using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.