PDA

View Full Version : Volume fog with multitexturing.. not working



zix99
07-03-2004, 06:09 PM
Well hello all,

I have made a nice terrain engine with one giant texture stretched out over it, and a detail map on it using multitexturing. I have looked at the NeHe tutorial for volume fog, and have searched these forums and google, and found no help.

Now... i initialize my fog like this:
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogfv(GL_FOG_COLOR,FogCol);
glFogf(GL_FOG_START,0.0f);
glFogf(GL_FOG_END,1.0f);
glHint(GL_FOG_HINT, GL_NICEST);
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);

And my terrain is drawn with quads like so:

glFogCoordfEXT(1.0f);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB,tmap[0][x][y],tmap[1][x][y]);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,0,0);
glVertex3f(x,y,ymap[x][y]);

glFogCoordfEXT(1.0f);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB,tmap[0][x+1][y],tmap[1][x+1][y]);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,1,0);
glVertex3f(x+1,y,ymap[x+1][y]);

glFogCoordfEXT(1.0f);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB,tmap[0][x+1][y+1],tmap[1][x+1][y+1]);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,1,1);
glVertex3f(x+1,y+1,ymap[x+1][y+1]);

glFogCoordfEXT(1.0f);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB,tmap[0][x][y+1],tmap[1][x][y+1]);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,0,1);
glVertex3f(x,y+1,ymap[x][y+1]);

I've tried placing glFogCoordfEXT in different positions for the verticies, and tried putting in different values for it. I've also tried different GL_FOG_START and GL_FOG_END values, with no luck. It always shades my terrain from one side to the other.. let's see if i can get a screenshot...
screenshot 1 (http://members.cox.net/rangers99/terrain.jpg) - this is the above view of the terrain, as you see it's shaded from one side to the other.

-I have no clue what's wrong, so thanks for any help.
zix