Sign in to follow this  
Daniel Lee

cube coloring and texturing

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this