From: curt Date: Wed, 3 Nov 1999 15:17:50 +0000 (+0000) Subject: Use a more standard texture/blend mode combination for sun/moon halos to X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=71abebe8371fdf28450f9793b856ffc68dcc5cbb;p=simgear.git Use a more standard texture/blend mode combination for sun/moon halos to avoid render path that's not supported by all cards/drivers. --- diff --git a/simgear/ephemeris/moon.cxx b/simgear/ephemeris/moon.cxx index 75d304c8..7b3d4b79 100644 --- a/simgear/ephemeris/moon.cxx +++ b/simgear/ephemeris/moon.cxx @@ -157,27 +157,22 @@ void Moon::setHalo() for (i=0; i < texWidth; i++) { for (j=0; j < texWidth; j++) { double x, y, d; - + + *p = 0xff; + *(p+1) = 0xff; + *(p+2) = 0xff; + x = fabs((double)(i - (texWidth / 2))); y = fabs((double)(j - (texWidth / 2))); d = sqrt((x * x) + (y * y)); - if (d < radius) - { + if (d < radius) { double t = 1.0 - (d / radius); // t is 1.0 at center, 0.0 at edge */ // inverse square looks nice - *p = (int)((double)0xff * (t * t)); - *(p+1) = (int)((double) 0xff * (t*t)); - *(p+2) = (int)((double) 0xff * (t*t)); - *(p+3) = 0x11; - } - else - { - *p = 0x00; - *(p+1) = 0x00; - *(p+2) = 0x00; - *(p+3) = 0x11; - } + *(p+3) = (int)((double) 0x20 * (t*t)); + } else { + *(p+3) = 0x00; + } p += 4; } } @@ -354,7 +349,8 @@ void Moon::newImage() // Draw the halo... if (current_options.get_textures()) { - glBlendFunc(GL_SRC_ALPHA, GL_ONE); + // glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; glEnable(GL_TEXTURE_2D); // TEXTURE ENABLED glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glBindTexture(GL_TEXTURE_2D, moon_halotexid); diff --git a/simgear/ephemeris/star.cxx b/simgear/ephemeris/star.cxx index c3985d7e..edf5223b 100644 --- a/simgear/ephemeris/star.cxx +++ b/simgear/ephemeris/star.cxx @@ -116,26 +116,21 @@ void Star::setTexture() for (j=0; j < texWidth; j++) { double x, y, d; + *p = 0xff; + *(p+1) = 0xff; + *(p+2) = 0xff; + x = fabs((double)(i - (texWidth / 2))); y = fabs((double)(j - (texWidth / 2))); d = sqrt((x * x) + (y * y)); - if (d < radius) - { + if (d < radius) { double t = 1.0 - (d / radius); // t is 1.0 at center, 0.0 at edge */ // inverse square looks nice - *p = (int)((double)0xff * (t * t)); - *(p+1) = (int)((double) 0xff * (t*t)); - *(p+2) = (int)((double) 0xff * (t*t)); *(p+3) = (int)((double) 0xff * (t*t)); - } - else - { - *p = 0x00; - *(p+1) = 0x00; - *(p+2) = 0x00; + } else { *(p+3) = 0x00; - } + } p += 4; } } @@ -238,7 +233,8 @@ void Star::newImage(void) glEnable(GL_TEXTURE_2D); // TEXTURE ENABLED glEnable(GL_BLEND); // BLEND ENABLED - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + // glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glBindTexture(GL_TEXTURE_2D, sun_texid);