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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:23:13+00:00 2026-06-13T23:23:13+00:00

I have been working through one of the NeHe tutorials (Lesson06) with texture mapping

  • 0

I have been working through one of the NeHe tutorials (Lesson06) with texture mapping and was trying to modify the code to allow different images on the already created 3D cube. After looking through the code, this is the only place were the code actually uses the image file:

TextureReader.Texture image = null;
try {
    image = TextureReader.readTexture("nehe/dice1.png");
} catch (IOException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
}

What I’m asking is how can you load 6 different images instead of just 1 to cover the entire cube? I am trying to make a “die” I have the images for 1 through 6. If you need to view the full code, you can find it at: http://www.java-tips.org/other-api-tips/jogl/texture-mapping-nehe-tutorial-jogl-port.html

  • 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-13T23:23:14+00:00Added an answer on June 13, 2026 at 11:23 pm

    You would have to create 6 separate texture IDs and bind to a specific texture ID before you draw each face. The call that actually creates a texture ID is here:

    texture = genTexture(gl);
    

    And then all the stuff that follows that call actually sets up the texture.

    It would be easier for you to load a single texture that contains the unwrapped die, or just simply contains the faces for 1 thru 6 in a line. Then it’s just a matter of specifying the correct texture co-ordinates to select the right part of the texture for each face.

    Instead of a face’s texture co-ords going from (0,0) to (1,1), they could go from ((num-1.0)/6.0, 0) to (num/6.0, 1) where num is a double between 1 and 6. In this case, you would line the images up horizontally.

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

Sidebar

Related Questions

I have been working at a few different companies now and every one has
I have been working through some code and I would like to work out
I've have been working on implementing the InfoBox code for one of my web
I have been working through some of the sync framework demos and one thing
I have been working through projects involving packages that do all the web design
I have been working through the tutorial adapting it to a project I want
I have been working with SQL Server as a Developer a while. One thing
I have been working in a big program and one of its functionalities should
I've been working through the javascript remote debug tutorials for WebStorm / IntelliJ(numbers.js) I've
I have been working through the tutorial by Alex Young on using flash messages

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.