cube coloring and texturing

Started by
5 comments, last by Daniel Lee 18 years, 10 months ago
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.
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
well it works, but how then do i get a white surface ?

ciao.
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();
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();


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 );
ok done thanks for the tips from all.

ciao

This topic is closed to new replies.

Advertisement