Fog not working as it should?
I've been trying to use fog to make the maximum view radius fade away into the background color... now my first problem is that the fog color isn't the same as the background color ( even though I use the same values) and that it's starting at the point I indicate, nor ending where I want.
CODE:
float fr = float(RSC.bg_1rgb[0]/255.0f);
float fg = float(RSC.bg_1rgb[1]/255.0f);
float fb = float(RSC.bg_1rgb[2]/255.0f);
glClearColor(fr,fg,fb,1.0f);
fogColor[0] = fr;fogColor[1]=fg;fogColor[2]=fb;fogColor[3]=1.0f;
glFogi (GL_FOG_MODE, GL_EXP2); // Fog Mode
glFogfv (GL_FOG_COLOR, fogColor);
glFogf (GL_FOG_DENSITY, 1.0f);
glHint (GL_FOG_HINT, GL_DONT_CARE);
glFogf (GL_FOG_START, 0.0f);
glFogf (GL_FOG_END, ViewR*RenDist);
yes I enabled the Fog >.< I'm not a retard.
Now here is what I get with that:
Now, it seems to render a line of non-fogged geometry at the point that the center of the camera is focused on. What I want it to do is to start near the very edge of the view distance, and end at the edge, to make the geometry there fade away.
What am I doing wrong? Or is OpenGL as bad as the DirectX lovers say it is?
>>What am I doing wrong?<<
not reading the instructions perhaps ;)
this
glFogi (GL_FOG_MODE, GL_EXP2); // Fog Mode
+
glFogf (GL_FOG_START, 0.0f);
glFogf (GL_FOG_END, ViewR*RenDist);
dont go together
//start+end go with linear, (exp/exp == density)
not reading the instructions perhaps ;)
this
glFogi (GL_FOG_MODE, GL_EXP2); // Fog Mode
+
glFogf (GL_FOG_START, 0.0f);
glFogf (GL_FOG_END, ViewR*RenDist);
dont go together
//start+end go with linear, (exp/exp == density)
I tried that! I tinkered with the types and the Density / distance! nothing worked. It always produced that kind of line >.<
glFogf (GL_FOG_END, ViewR*RenDist); -> Which values did you try?
What is your value for GL_FOG_COORD_SRC? GL_FOG_COORD or GL_FRAGMENT_DEPTH ?
Try GL_FOG_COORD_SRC = GL_FRAGMENT_DEPTH, GL_FOG_START = 0.0f and GL_FOG_END = 1.0f;
What is your value for GL_FOG_COORD_SRC? GL_FOG_COORD or GL_FRAGMENT_DEPTH ?
Try GL_FOG_COORD_SRC = GL_FRAGMENT_DEPTH, GL_FOG_START = 0.0f and GL_FOG_END = 1.0f;
Quote:Original post by Lord_Evil
glFogf (GL_FOG_END, ViewR*RenDist); -> Which values did you try?
What is your value for GL_FOG_COORD_SRC? GL_FOG_COORD or GL_FRAGMENT_DEPTH ?
Try GL_FOG_COORD_SRC = GL_FRAGMENT_DEPTH, GL_FOG_START = 0.0f and GL_FOG_END = 1.0f;
ViewR = 24 (int)
RenDist = 10.0f (float)
... what do those do >.< stupid OpenGL tutorial doesn't make any mention of those... I haven't set them at all infact... I wonder if they need a value other than the default?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement