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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:06:45+00:00 2026-05-24T19:06:45+00:00

I must be asking a very basic question. I’ve just learnt how to apply

  • 0

I must be asking a very basic question. I’ve just learnt how to apply textures.

Basically, I have a scene (a plane) and a cube on it. I apply a texture to one of the faces of the cube. The face of the cube I am trying to apply the texture to is red, but I want the texture color to override it, but they somehow blend together, although I have not enabled blending, nor is the texture image transparent!

Here’s my texture(.png).

enter image description here

And here’s the rendering:

enter image description here

Here are some relevant parts of my code ( I know I am doing many things wrong, like using triangle strips instead of quads, not using HLSL etc – I’m a newbie 🙂

Initing part:

//glInit
glClearColor(0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND); //<-- blending is disabled!

Texture part:

glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 4,  tex.width(), tex.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, tex.bits());
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // Linear Filtering
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

Drawing part:

glBegin(GL_TRIANGLE_STRIP);
   glColor3f(1, 0, 0);  //red front face
   glTexCoord2d(0, 0);
   glVertex3d(-a, -a, -a);
   glTexCoord2d(0, 1);
   glVertex3d(-a, -a, a);
   glTexCoord2d(1, 0);
   glVertex3d(a, -a, -a);
   glTexCoord2d(1, 1);
   glVertex3d(a, -a, a);
glEnd();

glBegin(GL_TRIANGLE_STRIP);
   glColor3f(0, 1, 0);  //green back face
   glVertex3d(-a, a, -a);
   glVertex3d(-a, a, a);
   glVertex3d(a, a, -a);
   glVertex3d(a, a, a);
glEnd();

glBegin(GL_TRIANGLE_STRIP);
   glColor3f(0, 0, 1);  //blue right face
   glVertex3d(a, -a, -a);
   glVertex3d(a, -a, a);
   glVertex3d(a, a, -a);
   glVertex3d(a, a, a);
glEnd();

//etc.

So, can you please help me to make the color of my texture preserve and not become reddish? If any other part of my code is needed to understand what I am doing wrong, just say, I’ll edit. Thank you very much in advance.

  • 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-24T19:06:46+00:00Added an answer on May 24, 2026 at 7:06 pm

    If you intend to draw one side of the cube with a texture, and the other sides without it, then you need to glEnable(GL_TEXTURE_2D) for the side with the texture and glDisable(GL_TEXTURE_2D) for the sides without it. That’s not your problem, but it still needs to be done.

    If you’re trying to render with just a texture, you could pass (1, 1, 1) for the color. However, that just paints over the issue.

    If you’re really going to stick with fixed function OpenGL, then you need to use the texture environment. Each texture unit (glActiveTexture(GL_TEXTURE0 + texture_unit)) has a “texture environment”, which is essentially a mathematical operation that combines a particular value fetched from the texture with the per-vertex interpolated color or the previous texture environment command. They are executed in texture unit order. The default is GL_MODULATE, which multiplies the color with the texture. You want GL_REPLACE.

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

Sidebar

Related Questions

I have already asked this question on ServerFault however I got very minimal replies....one
I'm asking the best solution for a very 'simple' problem. Today, I have emails
I must be dense. After asking several questions on StackOverflow, I am still at
I feel stupid for asking, but there must be a one liner that does
This must be a classic .NET question for anyone migrating from Java. .NET does
In asking this question, I'm looking for either better understanding of the situation or
What must not be in an AWK script? I am asking as I don't
After asking a question about sending 304 Not Modified for images stored in the
I must apologize if this is a duplicate question, but I can't seem to
I feel stupid asking this question, but I can not find a clear answer

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.