Normal glFog vs Register Combiner Fog

Hi im having some variance between what opengl gives me for fog and what register combiners give me. Passing both systems the exact same fog coord and color i get different output results.

For a fogcoord of 1 with a fogcolor of 243,220,197, register combiners give me 243,220,197 but normal glFog gives me 211,141,90.

In another scene changing the fogcolor to 204,204,187 gives me exactly that in regcomb, where normal fog gives me 104,104,73.

Does anybody know what extra math OpenGL is applying to my fog to get its color? Thanks.

Still no idea what causes this. Any clues? Is there a glFog setting that could cause these results? Im using arb_vertex_program to send fogcoords to OpenGL in both cases.

read it up. in short, there are 3 ways, and gl can choose if it wants to do it per vertex or perpixel.

But is there any place where I can retrieve the alternate formulas so that my two fog colors can match up?

I don’t think you can since OpenGL does not guarantee the exact fog computations.

[This message has been edited by vincoof (edited 12-10-2002).]

it does. i said read it up. opengl is fully documented. and you’re on why do you ask?

there are three types, linear, exp, and exp2, all 3 are perfectly documented how they get calculated, and how to force an implementation to do it per vertex, or per pixel, or how ever you want…

The fog mode is compleatly a vertex parameter is it not? I can change my glFogf parameters without affecting my end result at all when arb_vertex_program is enabled. All the OpenGL spec to my knowledge says is If enabled, fog blends a fog color with a rasterized fragment’s post-texturing color
using a blending factor f. That blending factor is given by result.fogcoord.x in ARBVP.

Now if i tell glFog that my color is a certain color why is my regcomb final combiner doing the correct blend of fogcol,finalcol, and fogfactor, whereas opengl is doing something different.

I ask because the problem doesnt seem as simple as the fogcoord isnt being generated correctly. In both cases my entire scene is bicolored one correct color my fog color for the regcomb objects, and two some seemingly random color for all glFogged objects. I deduce that in both cases my fogCoord is correctly set to 1 since all textures are bled out to the fog color.

davepermen: because hints implementations are free, you never know how OpenGL interprets the hint. That’s why IMO you can’t be 100% sure of what’s happening.

When you write “For a fogcoord of 1 with a fogcolor of 243,220,197, register combiners give me 243,220,197 but normal glFog gives me 211,141,90.”, what do you mean by “gives me” ? How do you query the value ?

I query the value by taking a screen capture and looking at the colors via picker in photoshop. Im sure doing a glReadPixels would probably give me the same results.

Sorry bout all the hassle fellows. I discovered the problem and as you can imagine it was pretty simple, that section of code was going through extra blending passes, to which fog was also enabled. Thanks for all the interest… I spend way to much time looking for something complicated to be the solution.