Game Development Community

Coloring Sky Box

by trickster · in Torque Game Engine · 01/21/2006 (11:26 pm) · 1 replies

I've been trying to get the sky box to fade to a solid color, to cover transitions from day to night. I put this in renderSkyBox:

ColorF tempColor;
tempColor.red = mRealSkyColor.red;
tempColor.green = mRealSkyColor.green;
tempColor.blue = mRealSkyColor.blue;
tempColor.alpha = mRealSkyColor.alpha;
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, tempColor);

glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_ALPHA,GL_REPLACE);

glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_RGB,GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_ALPHA,GL_TEXTURE);

glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB,GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_ALPHA,GL_CONSTANT);

That turns the box textures the color of the sky background, but the alpha has no effect. Instead, it seems to be getting the alpha from the RGB - white is transparent (just the textures), and black is opaque (just the color). Does anyone have any idea how this might work?

About the author

Recent Threads

  • Missions?

  • #1
    02/15/2006 (2:00 pm)
    You know the skybox, with out a texture applyed, has a color. yopu could just use that.