Results 1 to 2 of 2

Thread: GLScene Object Creation

  1. #1

    GLScene Object Creation

    Code:
    procedure InitializeObjects(Created:Boolean)
    const Colors : array [1..6] of TGLColor = (clrCoral, clrScarlet, clrSeagreen, clrSlateBlue,  clrTurquise,  clrCornFlowerBlue);
    var i : integer;
    begin
      for i:= 1 to 6 do begin
        If not Created then
          GLShape[i] := GLScene1.Objects.AddNewChild(TGLDodecahedron)
        GLShape[i].Position.X := -7 + i*2;
        GLShape[i].Position.Y := 4;
        GLShape[i].Material.FrontProperties.Diffuse := Colors[i];
      end;
    end;
    First error: My colors code... How can I get that to work?
    [Error] Unit2.pas(83): Incompatible types: 'TGLColor' and 'TVector4f'

    Second: I assume I am doing something wrong when creating the shapes...
    [Error] Unit2.pas(8: Incompatible types: 'TGLDodecahedron' and 'TGLBaseSceneObject'

    Help!

    I got the addnewchild code from the caperaven.co.za site (South African :! but it doesn't seem to work right.

    Thanks in advance.

  2. #2

    GLScene Object Creation

    [pascal]
    const Colors : array [1..6] of TColorVector = (
    {clrCoral} (1, 0.498039, 0.0, 1),
    {clrScarlet} (0.55, 0.09, 0.09, 1),
    {clrSeagreen} (0.137255, 0.556863, 0.419608, 1),
    {clrSlateBlue} (0, 0.498039, 1, 1),
    {clrTurquise} (0.678431, 0.917647, 0.917647, 1),
    {clrCornFlowerBlue} (0.258824, 0.258824, 0.435294, 1));
    [/pascal]

    It needs to be TColorVector.

    For the other part, GLShape[] was of type TDodecahedron, and should be of type TGLBaseSceneObject.[/code]

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
  •