• Advertisement
Sign in to follow this  

Textures and colors and spinning a cube

This topic is 4764 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

Is it possible to glcolor and texture in same program? I tried to do a program with a cube with some faces having color and some having textures, but when i run the progam the texture faces becomes colors how can I have texture and colors? Another note, I tried to program to have a cube rotate directly on one of its corners, like how a top spins on one point except much slower. So how much rotation on which axis should I assign to get the result i desire.

Share this post


Link to post
Share on other sites
Advertisement
To have a cube with textures and colors, just clear the color before the textureing. That way the textured quad will retain the color of the texture and then change the color for the quad without the texture.

If you want the cube to rotate on a corner, use a static rotate(glRotatef(90, 0.0f, 1.0f, 0.0f)) to position the cube, then call a dynamic rotate (glRotatef(angle, 0.0f, 1.0f, 0.0f)) to rotate around the y-axis.

dimebag

Share this post


Link to post
Share on other sites
To use textures just call

glEnable(GL_TEXTURE_2D);

If you want to use colored faces after that, just disable the textures and go with your colors:

glDisable(GL_TEXTURE_2D);

Hope it helps :-)

Share this post


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

  • Advertisement