Bug with ShapeBase::startFade()?
by Markus Nuebel · in Torque Game Engine · 01/30/2006 (1:14 pm) · 3 replies
I am using ShapeBase::startFade() to smoothly add/remove objects from the scene.
However, this does not work with the opengl2d3d wrapper, with applied lighting pack.
Objects are popping in and out instantly, without any fade.
In TSMesh::setMaterial() an OpenGL blending is setup, using the overrideFadeValue of the object, which get's modulated during the fade duration.
In the wrapper function for glTexEnvf the lighting pack executes:
As far as I know, this is not enough.
To make this work a call to
The lighting pack defines a lot of StateBlocks that are switched/enabled depending on the rendering settings. However, there is no state block, that uses D3DTA_TFACTOR as an alpha blend arg and obviously no code, that switches to this block.
Tried to figure this out on my own, but the state management in this dll is quite complicated.
John, could you please verify this and in case you find a solution, provide me with a fix.
This issue is one of a few issues, that needs to be fixed for our upcoming release.
-- Markus
However, this does not work with the opengl2d3d wrapper, with applied lighting pack.
Objects are popping in and out instantly, without any fade.
In TSMesh::setMaterial() an OpenGL blending is setup, using the overrideFadeValue of the object, which get's modulated during the fade duration.
if( overrideFadeVal < 1.0f && dglDoesSupportTextureEnvCombine() )
{
...
ColorF curColor;
glGetFloatv( GL_FOG_COLOR, (GLfloat*)&curColor );
curColor.alpha = overrideFadeVal;
...
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, curColor);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_ALPHA_EXT,GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_ALPHA_EXT,GL_CONSTANT_EXT);
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_ALPHA_EXT,GL_SRC_ALPHA);
...
}In the wrapper function for glTexEnvf the lighting pack executes:
if(((int)param) == GL_CONSTANT_EXT) g.m_d3ddev->SetRenderState(D3DRENDERSTATE_TEXTUREFACTOR, g.m_envcolor);
As far as I know, this is not enough.
To make this work a call to
SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TFACTOR);also needs to be issued, to make that state use the supplied alpha color.
The lighting pack defines a lot of StateBlocks that are switched/enabled depending on the rendering settings. However, there is no state block, that uses D3DTA_TFACTOR as an alpha blend arg and obviously no code, that switches to this block.
Tried to figure this out on my own, but the state management in this dll is quite complicated.
John, could you please verify this and in case you find a solution, provide me with a fix.
This issue is one of a few issues, that needs to be fixed for our upcoming release.
-- Markus
About the author
#2
I am using TGE 1.3 and LP1.3 this doesn't seem to be a problem of TGE. startFade works fine with the OpenGL renderer.
Any ideas?
-- Markus
02/04/2006 (3:00 am)
Hi John.I am using TGE 1.3 and LP1.3 this doesn't seem to be a problem of TGE. startFade works fine with the OpenGL renderer.
Any ideas?
-- Markus
#3
Not sure I'm following that. The DirectX startFade is broken in TGE 1.4 and TLK 1.4, though the code hasn't changed much, if at all, in TGE between 1.3 and 1.4 (I still need to verify that).
I need to see what GG does to resolve the issue in TGE 1.4 in order to best address the TLK code (if they make heavy changes to the DirectX wrapper or the startFade code I'll end-up rewriting the TLK code again).
Did you report the startFade TGE 1.4 bug in the Torque bug forums? Definitely post this TGE 1.4 bug there, so the guys know to look into it and hopefully a fix will make it into the 1.4.1 release.
-John
02/06/2006 (8:34 am)
Hi Markus,Not sure I'm following that. The DirectX startFade is broken in TGE 1.4 and TLK 1.4, though the code hasn't changed much, if at all, in TGE between 1.3 and 1.4 (I still need to verify that).
I need to see what GG does to resolve the issue in TGE 1.4 in order to best address the TLK code (if they make heavy changes to the DirectX wrapper or the startFade code I'll end-up rewriting the TLK code again).
Did you report the startFade TGE 1.4 bug in the Torque bug forums? Definitely post this TGE 1.4 bug there, so the guys know to look into it and hopefully a fix will make it into the 1.4.1 release.
-John
Torque Owner John Kabus (BobTheCBuilder)
Unfortunately startFade with DirectX is broken in stock torque 1.4. The DirectX wrapper hasn't changed, so it might not have ever worked. I'll keep this in mind though.
-John