Is this fog, or is it me?

Started by darkprophet, December 18, 2003, 17:17:22

Previous topic - Next topic

darkprophet

hi all,
i have been through the NeHe fog tutorial (the normal one, not the volumetric !!) and ive noticed something:

i have an object (a sphere) that slowly moves towards the screen ( the z-index decreases..durr) however, when its in the background its black, how can I make it basically dissappear and appear slowly as its coming towards the screen.

The start and stop fog are as follows:
start: 0.0f
end: 10.0f

and this density thing, it doesn't absolutely nothing!

princec

If you want it to appear slowly then it the background colour has to be the same colour as the fog you're using when you draw the sphere.

Cas :)

darkprophet

it aint happening baby!! lol, umm...i did this:

private float fogColorF[] = { 0.5f, 0.5f, 0.5f };

public void initGL() {
 // some crap goes here.
 // here and there -->

 glClearColor(0.5f, 0.5f, 0.5f, 1.0f); // background colour

 // other crap
 // now fog stuff
 ByteBuffer temp = ByteBuffer.allocateDirect(16);
 temp.asFloatBuffer().put(fogColorF).flip();
 glFogi(GL_FOG_MODE, fogMode[2]);
 glFog(GL_FOG_COLOR, temp.asFloatBuffer());
 glFogf(GL_FOG_DENSITY, 0.9f);
 glHint(GL_FOG_HINT, GL_DONT_CARE);
 glFogf(GL_FOG_START, 0f);
 glFogf(GL_FOG_END, 10f);
 glEnable(GL_FOG);

 // sync and load textures below
}


still not working...any idea?

princec

No idea. Post a screenie?

Cas :)

darkprophet

yeah sure...



thats basically it, and then after that the texture (as the sphere moves forwards) appears slowly (which I want), but the sphere is black..is there a way in which I can make the whole thing appear slowly?

darkprophet