• Advertisement
Sign in to follow this  

Fog Problem

This topic is 4490 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My fog works when I'm just rendering meshes but after I render text and UI stuff it doesnt show up. I tried disabling and enabling it before and after rendering meshes/text but no results. I'm using DX9 aug. update I setup the fog in ResetDevice: float Start = 300.0f; float End = 475.0f; pd3dDevice->SetRenderState(D3DRS_FOGENABLE, TRUE); pd3dDevice->SetRenderState(D3DRS_FOGCOLOR, D3DCOLOR_XRGB(150,160,175) ); pd3dDevice->SetRenderState(D3DRS_FOGTABLEMODE, D3DFOG_LINEAR); pd3dDevice->SetRenderState(D3DRS_FOGVERTEXMODE,D3DFOG_LINEAR); pd3dDevice->SetRenderState(D3DRS_FOGSTART, *(DWORD *)(&Start)); pd3dDevice->SetRenderState(D3DRS_FOGEND, *(DWORD *)(&End)); Heres part of the FrameMove code: // Text & UI //RenderText(); //V( g_HUD.OnRender( fElapsedTime ) ); RenderText uses DXUTTextHelper. If I call either of these fog does not show up. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Are you rendering the fog before or after you draw the text? If it's after, it's probably just a problem with the render state. Many upon many times in the past I've had problems rendering things after text because I changed the render state to do it. Check on that and make sure that if it's changing the renders state, you change it back to whatever it previously was before rendering the fog.

-Jeff

Share this post


Link to post
Share on other sites
As GodlyGamr says, it's a problem with a state that's not restored. Generally, ResetDevice should only setup the "default" states in your system. Then, whenever you want to render something, you set the states specific to that thing. In your case, fog really doesn't apply to text and UI, so they'll most definitely disable it. Whenever you try to render your world after them, make sure you enable fog, and restore all other relevant states as well (states that were modified by the text and UI renderers).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement