Fun with fog

I have an application in which I have a smokey room with a TV screen in it. The TV screen shows an exterior view of the building.

What I’m trying to do is to render the outdoor scene as shown on the monitor using a portal, then masking the tv screen off and finally rendering the room’s interior to complete the scene. The problem is that it’s foggy outdoors and smoky indoors. In other words, I need one fog setting for the outdoor portion of the rendering, and another for the indoor. Can you do this or will changing the fog settings just cause the rendering to use the last known fog values globally? Also, when does the fog get applied to the scene? What triggers the shading to take effect?

I don’t know if this will work…but it’s an idea. First draw everything in the room but the stuff rendered in the TV. The the tv would be blank in the screen. Make sure all effects for the room are turned on at this point. Then use glScissor, to crop down the scene to JUST the tv screen…and then do everything you need to do in there.

Check out this tutorial for info on how to use glScissor:

You can call glEnable(GL_FOG), glDisable(GL_FOG) in different part of your program. However, best solution should be - use pbuffer, unfortunately I havn’t learned it yet. The idea is - you render your scene in pbuffer, then clip part of the image and use it to create texture (MIPMAP_SGIS could be used for preformace) which you can map to rectangle (screen)