Game Development Community

Undo blackout.

by Bullitt Sesariza · in Torque Game Engine · 06/16/2008 (8:14 pm) · 1 replies

Hi, just a quick one. How do I undo a blackout? I've tried:

ServerConnection.setBlackOut(false,0);

but it didn't work. Thanks in advance.

#1
06/17/2008 (9:02 am)
Fixed it (with a brute hack). It seems like the game will ignore the blackout if the control object is deleted. And in my case, I use blackout and a schedule to delete the player / control object. So I moved the blackout filter rendering out of the psb / current camera query's control object like so:

ShapeBase* psb = dynamic_cast<ShapeBase*>(camq.object);

    //HACK MANIA!!!!!! Will always execute blackout regardless of whether or not there's a control object
    [b]if (blackOut > 0.0f) {
         Con::printf("---------Blackout= %f", blackOut); //Print blackout to consoles
         glMatrixMode(GL_MODELVIEW);
         glPushMatrix();
         glLoadIdentity();
         glMatrixMode(GL_PROJECTION);
         glPushMatrix();
         glLoadIdentity();

         glDisable(GL_TEXTURE_2D);
         glEnable(GL_BLEND);
         glDepthMask(GL_FALSE);
         glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
         glColor4f(0.0f, 0.0f, 0.0f, (blackOut > 1.0f ? 1.0f : blackOut));
         glBegin(GL_TRIANGLE_FAN);
         glVertex3f(-1.0f, -1.0f, 0.0f);
         glVertex3f(-1.0f,  1.0f, 0.0f);
         glVertex3f( 1.0f,  1.0f, 0.0f);
         glVertex3f( 1.0f, -1.0f, 0.0f);
         glEnd();
         glDisable(GL_BLEND);
         glBlendFunc(GL_ONE, GL_ZERO);
         glDepthMask(GL_TRUE);

         glMatrixMode(GL_PROJECTION);
         glPopMatrix();
         glMatrixMode(GL_MODELVIEW);
         glPopMatrix();
      }[/b]
   if (psb != NULL) {
    [i]the codes were previously inside this if statement... [/i]

I assume that because the blackout rendering statement doesn't call the psb object at all, it would be save to move it outside of the if statement. CMIIW please. Dunno if it would make an error elsewhere. So far so good though. Consider the problem solved for now. Sorry for the trouble.