PDA

View Full Version : GLScene Object Creation



Canderel
23-04-2004, 08:20 AM
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(88): 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.

Canderel
28-04-2004, 12:09 PM
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));


It needs to be TColorVector.

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