GarageGames/Torque3D — pull request #747 by LuisAntonRebollo (2014-08-03 10:59:39+00:00)
Title: Fix WaterObject loose reflection bug.

See GG forum: [Reflection Rendering Bug (GF 600 Series Only?)](http://www.garagegames.com/community/forums/viewthread/134050)

I have dedicated some time to this weird bug.

After pass the O_o phase, i tracked the problem:
* It's resollution dependent.
* First frame's call to ```REFLECTMGR->getRefractTex()``` break current occlusion query.
* Seem [read from current render target](https://github.com/GarageGames/Torque3D/blob/8142a3e9645e881cd8e21434809289855e57a0b4/Engine/source/scene/reflectionManager.cpp#L265) when a occlusion query are active it's the problem.

For a simple fix i recomend call ```REFLECTMGR->getRefractTex()``` before begin the occlusion query on ´´´WaterObject::renderObject```

```cpp
void WaterObject::renderObject( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat )
{
if ( overrideMat )
return;

GFXOcclusionQuery *query = mPlaneReflector.getOcclusionQuery();

bool doQuery = ( !mPlaneReflector.mQueryPending && query && mReflectorDesc.useOcclusionQuery );

REFLECTMGR->getRefractTex();

if ( doQuery )
query->begin();

// Real render call, done by derived class.
innerRender( state );

if ( doQuery )
query->end();

if ( mUnderwater && mBasicLighting )
drawUnderwaterFilter( state );
}
```

* Anyone can test the fix?
* Anyone can reproduce this problem on a non Nvidia card?
* A DirectX9 limitation or a driver's bug?