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 4607698
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:44:23+00:00 2026-05-22T00:44:23+00:00

The following code produces the image that follows. The image I am using for

  • 0

The following code produces the image that follows. The image I am using for the background is 640 x 480, as is the displayMode. The texture background is a .bmp and is loaded with the Slick texture loader. I am confuse to why it is not filling the Quad and why it is reflected.
EDIT: The background of my OpenGL scene is pink, the black you see is from the Quad created. The background image is the green block with a 2px light blue border with “test” plastered on it.

private void renderBackground(){
    float w = displayMode.getHeight()/2;
    float h = displayMode.getWidth()/2;

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();

    GL11.glLoadIdentity();
    GLU.gluOrtho2D(-w, w, -h, h);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();

    GL11.glLoadIdentity();      
    GL11.glDisable(GL11.GL_DEPTH_TEST);

    if(useTextures)background.bind();
    GL11.glBegin(GL11.GL_QUADS);

    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex2f(-w,-h);

    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex2f(w,-h);

    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex2f(w, h);

    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex2f(-w, h);

    GL11.glEnd();

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
}

OpenGL Texture mismapping

Now when I add GL11.glTranslatef(20.0f, 20.0f, 0.0f); you will notice that the pink appears, which is the colour created int my “initGL” method:
GL11.glClearColor(1.0f, 0.75f, 0.796f, 0.0f);
enter image description here

My GL_PROJECTION contains the following before pushing it, my GL_MODELVIEW is unmodified when renderBackground() is called.

    GL11.glMatrixMode(GL11.GL_PROJECTION); // Select The Projection Matrix
    GL11.glLoadIdentity(); // Reset The Projection Matrix

    // Calculate The Aspect Ratio Of The Window
    GLU.gluPerspective(45.0f, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 0.1f, 25.0f);
    //position camera
    GLU.gluLookAt(5.0f, 3.0f, -5.0f, 0.0f, 0.0f, -10.0f, 0.0f, 1.0f, 0.0f);
    GL11.glMatrixMode(GL11.GL_MODELVIEW); // Select The Modelview Matrix
  • 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-05-22T00:44:24+00:00Added an answer on May 22, 2026 at 12:44 am

    I need more information to determine the problem, but here is a list with some possibilities.

    1) You are using an older video card, which does not support texture non-power of 2, since you are using a library to load the texture, maybe it is detecting it, creating a power of two image, and filling it with black.

    2) You (or some library you are using) changed the matrix of the texture matrix stack, and it is changing the texture coordinates.

    3) You are doing something wrong when you load the texture (or call the library to do so).

    The first thing I would check is if your video card supports texture non-power of 2 extension. You can check it at runtime, see how to detect if openGL/card supports non power of 2?

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

Sidebar

Related Questions

I am using the following code for displaying the products of an e-commerce website.
I'm using the following code to create divs with random products. The JSON data
I have the following HTML code stored in a javascript string: and I am
The following code uploads multiple images no problem. However, I'm trying to get it
I use the following code all the time in my view controller: UIView *view
I am having problems with the following code: function http_file_exists($url){ $f=fopen($url,r); if($f){ fclose($f); return
I have the following php, <ul> <?php $count = count($products); ?> <?php for($i=0; $i
Let me ask this a different way: based on the url I want to
I have a database with a number of records in it, each with an
I am making an archive for a directory, where each file has a name

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.