LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: darkprophet on December 18, 2003, 17:17:22

Title: Is this fog, or is it me?
Post by: darkprophet on December 18, 2003, 17:17:22
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!
Title: Is this fog, or is it me?
Post by: princec on December 18, 2003, 17:43:28
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 :)
Title: Is this fog, or is it me?
Post by: darkprophet on December 18, 2003, 17:54:04
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?
Title: Is this fog, or is it me?
Post by: princec on December 18, 2003, 20:33:38
No idea. Post a screenie?

Cas :)
Title: Is this fog, or is it me?
Post by: darkprophet on December 19, 2003, 16:06:09
yeah sure...

(http://www34.brinkster.com/volatile7/image1.PNG)

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?
Title: Is this fog, or is it me?
Post by: darkprophet on December 19, 2003, 16:07:17
darn it...il give ya the url instead!!

http://www34.brinkster.com/volatile7/image1.PNG