Results 1 to 2 of 2

Thread: Can i change Emition Color to a GLHudSprite object in GLScene?

  1. #1

    Can i change Emition Color to a GLHudSprite object in GLScene?

    i use this function to get the material

    function AddMaterial(aMatLib: TGlMaterialLibrary; aFileName, aMaterialName: string):TGlLibMaterial;
    begin
    result := aMatLib.Materials.Add;
    with result do
    begin
    with Material do
    begin
    MaterialOptions := [moIgnoreFog, moNoLighting];
    Texture.Disabled := false;
    BlendingMode := bmTransparency;
    Texture.TextureMode := tmModulate;
    with FrontProperties do
    begin
    Ambient.SetColor(1, 1, 1, 1);
    Diffuse.SetColor(1, 1, 1, 1);
    Emission.SetColor(1, 1, 1, 1);
    Specular.SetColor(1, 1, 1, 1);
    end;
    Texture.ImageClassName := 'TGLCompositeImage';
    if ExtractFileExt(aFileName) = '' then
    TGLCompositeImage(Texture.Image).LoadFromFile(aFil eName + '.png')
    else
    TGLCompositeImage(Texture.Image).LoadFromFile(aFil eName);
    //TGLCompositeImage(Texture.Image).LoadFromFile(aFil eName);
    end;
    Name := aMaterialName;
    end;
    end;

    second i add an onmouse move procedure

    first the const vector colors

    const
    OnMoveInObjects_Color: TColorVector = (0.243, 0.243, 0.243, 1.000);
    OnOutObjects_Color: TColorVector = (0.000, 0.000, 0.000, 1.000);

    and then the procedure

    procedure Check_Mouse_UpPlayer(x,y:Integer);
    var
    sTVol: FLOAT;
    begin
    if MainForm.IsMouseOverImage(fsExit,x,y) then
    begin
    fsExit.Material.FrontProperties.Emission.Color:= OnMoveInObjects_Color;
    if IsKeyDown(VK_LBUTTON) then
    begin
    fade_blur:= true;
    ShowExit;
    end;
    end
    else
    fsExit.Material.FrontProperties.Emission.Color:= OnOutObjects_Color;
    end;

    and here is the ismouseoverImage function...

    function TMainForm.IsMouseOverImage(const AButton: TGLHudSprite; const X, Y: Integer):Boolean;
    begin
    Result := (X >= AButton.Position.X - AButton.Width / 2) and (X <= AButton.Position.X + AButton.Width / 2) and
    (Y >= AButton.Position.Y - AButton.Height / 2) and (Y <= AButton.Position.Y + AButton.Height / 2);
    end;

    Now when the mouse is over the image the material change the emition color but i dont get results... (i don't see anything).

    What i am doing wrong...?

    Thank you...

  2. #2
    chate the Emission color to Emission.SetColor(1, 1, 0, 0);hope it help

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Comodo SSL