Advertisement Jump to content
Sign in to follow this  
Daniel Lee

cube coloring and texturing

This topic is 4981 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

allo, working on a cube with 4 sides to have colors and 2 remaining side to be textured. But could not get it correct. The extract of my code is :- glBegin(GL_QUADS); glColor3f(GREEN); glVertex(...); ... glEnd(); glBindTexture(...); glBegin(GL_QUADS); glTexCoord2f(..); glVertex3f(...); ... glEnd(); But the resultant was appearing GREENISH all over. Even the texture is Greenish. The situation should be isolated. That is the 4 faces should be colored and the 2 faces with textures only. but how, please advise. ciao.

Share this post


Link to post
Share on other sites
Advertisement
The color is a material and the texture is a texture. When applying a texture it is combined with the active material to produce the final color. Solution: before rendering the textured sides set the color to white.

Greetz,

Illco

Share this post


Link to post
Share on other sites
Quote:
Original post by Daniel Lee
well it works, but how then do i get a white surface ?

ciao.



glBegin(GL_QUADS);
glColor3f(GREEN);
glVertex(...);
...
glEnd();

glColor3f(WHITE);
glBindTexture(...);
glBegin(GL_QUADS);
glTexCoord2f(..); glVertex3f(...);
...
glEnd();


Share this post


Link to post
Share on other sites
but i did, no white on the sides. the code was :-

glBegin(GL_QUADS);
glColor3f(GREEN);
glVertex(...);
...
glEnd();

/*=== expects white side ===*/
glBegin(GL_QUADS);
glColor3f(WHITE);
glVertex(...);
...
glEnd();

...

glColor3f(WHITE);
glBindTexture(...);
glBegin(GL_QUADS);
glTexCoord2f(..); glVertex3f(...);
...
glEnd();


Share this post


Link to post
Share on other sites
have you enabled and disabled texturing before and after you draw the textures like this.

glEnable(GL_TEXTURE_2D);

glBindTexture(...);
glBegin(GL_QUADS);
glColor3f(WHITE);
glTexCoord2f(..); glVertex3f(...);
...
glEnd();
glDisable( GL_TEXTURE_2D );

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!