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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:02:56+00:00 2026-05-26T18:02:56+00:00

I am rendering a chess board, using 2 different textures. One for the black

  • 0

I am rendering a chess board, using 2 different textures. One for the black squares and one for the white squares. However instead of each different square having their own texture, they all take on the last texture that I bound calling glBindTexture(GL_TEXTURE_2D, id);.

This is my approach:

glEnable(GL_TEXTURE_2D);    
glBegin(GL_QUADS);
    // square 0, 0 ( front left )
    glBindTexture(GL_TEXTURE_2D, textureBlackSquare->texID);
    glNormal3f(0, 1, 0);
    glTexCoord2f(0, 0); glVertex3f(-8.0, 0.5,  8.0);
    glTexCoord2f(1, 0); glVertex3f(-6.0, 0.5,  8.0);
    glTexCoord2f(1, 1); glVertex3f(-6.0, 0.5,  6.0);
    glTexCoord2f(0, 1); glVertex3f(-8.0, 0.5,  6.0);
glEnd();

glBegin(GL_QUADS);
    // square 1, 0        
    glBindTexture(GL_TEXTURE_2D, textureWhiteSquare->texID);
    glTexCoord2f(0, 0); glVertex3f(-6.0, 0.5,  8.0);
    glTexCoord2f(1, 0); glVertex3f(-4.0, 0.5,  8.0);
    glTexCoord2f(1, 1); glVertex3f(-4.0, 0.5,  6.0);
    glTexCoord2f(0, 1); glVertex3f(-6.0, 0.5,  6.0);
glEnd();

When I run this code, both quads have the white texture bound. How do I get each quad to have its own texture?

  • 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-26T18:02:57+00:00Added an answer on May 26, 2026 at 6:02 pm

    You cannot call glBindTexture in the middle of glBegin/End. You can only call vertex functions within begin/end.

    Also, why don’t you just make a single texture as an 8×8 checkerboard, and then just render a single quad to draw the whole checkerboard?

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

Sidebar

Related Questions

I am having difficulties rendering several patterns (each with different texture) in the 2d
I'm having trouble rendering my form's fields with WTForms. I'm using it with the
I am rendering a cylinder and mapping two different textures to the top and
I'm having major rendering issues in Safari with the web application I'm working on.
I'm rendering a drop down list using Html.DropDownListFor() extension. The markup I get is
Rendering a partial using AJAX $('#next_videos').replaceWith('<%= render(:partial => 'videos')%>'); is my js the partial
I'm rendering a xps file using flash (no MX or Spark), and I'm running
I am rendering a scene to a texture, then using that texture and its
I am working on rendering a set of cart items using a user control.
Rendering contexts usually have a solid color on the background (black or whatever, see

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.