OpenGL Library for Delphi,
maintained by Eric Grange,
based on Mike Lischke's GLScene.

 

Tips - How to fade a texture


The idea here is to simply reduce the diffuse RBG values in the textures material library. Which in turn reduces the materials ability to reflect light. Set the materials texturemode to tmModulate then progressively reduce the diffuse RGB values.

diffuseval := 0.8;
procedure TForm1.GLCadencer1Progress(Sender: TObject; const deltaTime, newTime: Double);
begin
   if diffuseval <= 0.09 then
     begin // blacked out do tex change
       fadeup := true;
       with GLMaterialLibrary1.Materials[0] do
       begin
         if GLMaterialLibrary1.Tag = 0 then
           begin
             Material.Texture.Assign(BM2);
             GLMaterialLibrary1.Tag := 1;
           end
         else
           begin
             Material.Texture.Assign(BM1);
             GLMaterialLibrary1.Tag := 0;
           end;
       end;
     end
   else
     if diffuseval>= 0.8 then
       fadeup := false;

   if Fadeup then
     diffuseval := diffuseval + deltatime * 0.1
   else
     diffuseval := diffuseval - deltatime * 0.1;

   with GLMaterialLibrary1.Materials[0] do
   begin
     Material.FrontProperties.Diffuse.Red := diffuseval;
     Material.FrontProperties.Diffuse.Blue := diffuseval;
     Material.FrontProperties.Diffuse.Green := diffuseval;
   end;
end;
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.0573 seconds