transitioning from 1 texture to another
You need to revert all of the state. So for example, with the 3-unit code, I set texture0 to
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
That will kill all transparency, you need to set it back to DECAL or MODULATE depending if you're doing blending.
Similarly disable glColorMaterial and any other state that was changed for the terrain render. GL is just a big state machine, remember...
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
That will kill all transparency, you need to set it back to DECAL or MODULATE depending if you're doing blending.
Similarly disable glColorMaterial and any other state that was changed for the terrain render. GL is just a big state machine, remember...
That makes perfect sense, and simply putting a glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); on each texture fixed that.
But I still have an odd red tint, here is a screenshot
But I still have an odd red tint, here is a screenshot
Jake Wrote:There is a red tint to everything, mostly in the distance
Since it's in the distance, it could be fog or mipmap related. But I'm not sure what'd be causing that in relation to the texture combine environment. I'd start with searching all your source for red color constants. My code snippets used a red tint as an example, but your actual material colors should be 1.0, 1.0, 1.0, blendfactor...
Hum... I just commented out any line with fog and turned the textures to linear and it still didn't help. I searched for any occurrence of 1.0 or 0.0 in my render code and didn't find anything red. I am clueless here...
what about red textures? try turning off all texture units
I got rid of the second and third texutre unit, leaving this
Meaning its probably the colormaterial
Code:
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT, GL_DIFFUSE);
glActiveTextureARB(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, gv->texture[m]);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);Meaning its probably the colormaterial
arekkusu Wrote:And here's another approach, which does the interpolation and color tinting using only two texture units:
However this uses ARB_texture_env_crossbar functionality, which is only exported on Radeon7000+ under 10.3 (or Radeon9600 under 10.2.) It won't work on Rage128 due to hardware limitations. It *might* work on the nvidia cards even though the extension isn't exported, I haven't tested. So this might be a way to get your effect to work on GF2MX and GF4MX cards in only one pass. But you'll still need two passes for Rage128.
WOW! I missed over that post completely! I just added that to my code and it works great with a mobile 9200. Can anyone confirm if that works on a nvidia card?
Also, the red tint is still there
Jake Wrote:Meaning its probably the colormaterialWell, look at your vertex colors then. Don't use red.
Jake Wrote:Can anyone confirm if that works on a nvidia card?I did test this in the lab on Tuesday and it looks like texture_env_crossbar will work under 10.3 on all nvidia and ATI cards newer than the Rage128. However the extension isn't exported on any nvidia cards. There is a discussion about this here (and searching for "nvidia crossbar" finds many other threads.)
It also isn't exported on 10.2 on a lot of ATI cards, I don't know if it will work or not there. I'm at the point where I'm requiring 10.3 for all new projects...
My vertex colors are all 1.0,1.0,1.0 though, how could that only effect red?
I want to be really safe because this is a shareware game I want everyone to be able to play.I should check the version of OS X, if its 10.2 use 3 texture units, and if its 10.3 use 2 units, but first check to see if I have that many units available first. Right?
I want to be really safe because this is a shareware game I want everyone to be able to play.I should check the version of OS X, if its 10.2 use 3 texture units, and if its 10.3 use 2 units, but first check to see if I have that many units available first. Right?
You have lighting on though. So the vertex colors are affected by the light and ambient colors.
If you want to support 10.2 and Rage 128, I think your fallback mechanism will have to do two passes. You may be able to run on all other cards with only two units using crossbar, on both 10.2 and 10.3. But you'll have to test it to make sure it works. That's what labs and public beta tests are good for.
If you want to support 10.2 and Rage 128, I think your fallback mechanism will have to do two passes. You may be able to run on all other cards with only two units using crossbar, on both 10.2 and 10.3. But you'll have to test it to make sure it works. That's what labs and public beta tests are good for.
Ah, I just found out I needed to put a glColor3f(.3,.3,.3) before these lines, thats where my red tint was coming from.
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT, GL_DIFFUSE);
I should have a public beta soon, I am kind of excited about this release because I have put a lot of effort into it and it should help my registration conversion rate, as well as a smaller file size should get more downloads.
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT, GL_DIFFUSE);
I should have a public beta soon, I am kind of excited about this release because I have put a lot of effort into it and it should help my registration conversion rate, as well as a smaller file size should get more downloads.
arekkusu Wrote:... it looks like texture_env_crossbar will work under 10.3 on all nvidia and ATI cards newer than the Rage128. However the extension isn't exported on any nvidia cards.
As of 10.3.6, it is exported on all nvidia cards, see chart. That's a hint that it will work in any OS version, though you still need to test it.
arekkusu Wrote:It also isn't exported on 10.2 on a lot of ATI cards, I don't know if it will work or not there.Looks like it definitely does not work on some ATI cards under 10.2.8; the 7000, 7200, and 7500 at least. It appears to work on the 9000, 9200, 9600 and nvidia cards, at least the one case I tried. Probably safest to just require 10.3.
Thanks. What I am doing now is if the user has 10.2 I default to my OLD render mode, if they have 10.2 with >=3 texture units, I use the 3 texture unit solution you made. If they have 10.3 and >1 texture unit I use the crossbar method.

