Recent

Author Topic: Puzzled by child object behavior  (Read 15876 times)

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Puzzled by child object behavior
« Reply #15 on: June 23, 2011, 01:00:53 pm »
Thanks Carver,

I asked because I get error messages from the Lazarus debugger when I use the latest svn OS X version, so I don't use it on a regular basis. I've been running it on a separate computer just to check bug fixes.

I'm sure you already know, but it took me a while to find the hidden .lazarus directory in my home directory (found with ls -a). Deleting that helped a clean install.

I am curious to try out the new types, but may wait for a final release.

Cheers,
Frederick
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Puzzled by child object behavior
« Reply #16 on: June 23, 2011, 01:19:43 pm »
Just for the record, I tried this as well:

Code: [Select]
TArray4x4 = array[0..3] of array[0..3] of double;

TMatrix4x4 = object
 private
    fa: TArray4x4;

and it really does not work, even without inheritance.
« Last Edit: June 23, 2011, 01:22:15 pm by Frederick »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12202
  • Debugger - SynEdit - and more
    • wiki
Mac GDB [Re: Puzzled by child object behavior]
« Reply #17 on: June 23, 2011, 01:46:54 pm »
I asked because I get error messages from the Lazarus debugger when I use the latest svn OS X version,

Can you describe this issue in more detail please?
Please copy at least the "debug output" window, and the actual error msg you get.

http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Reporting_Bugs

And very important: 32 bit or 64 bit CPU on your Mac?



Carver413

  • Full Member
  • ***
  • Posts: 119
Re: Puzzled by child object behavior
« Reply #18 on: June 23, 2011, 05:42:04 pm »
to use advanced records you must add this to your unit
{$modeswitch advancedrecords}

Lazarus doesn't really like advanced records too much mostly because it doesn't understand them but I haven't gotten any debuger errors.
Code: [Select]
TMatrix4 = packed record
    Procedure Identity;
    Procedure Projection(vFov,vRatio,vNear,vFar:Single);
    Procedure Translation(vX,vY,vZ:Single);
    Procedure RotateAxisX(vAngle:Single);
    Procedure RotateAxisY(vAngle:Single);
    Procedure RotateAxisZ(vAngle:Single);
    Procedure Multiply(const vMatrix1,vMatrix2:TMatrix4);
  public
    case Integer of
      0:(S:Array [0..15] of Single);
      1:(D:Array [0..3,0..3] of Single);
      2:(C:Array [0..3] of TVector4);
  end;

this it what I have working at the moment.
Code: [Select]
  TranMatrix.Translation( 0,-2,-10);
  RotMatrix.RotateAxisY(45);
  ProjMatrix.Multiply(RotMatrix,TranMatrix);
  ViewMatrix.Projection(45,0.75,0,1000);
  ProjMatrixLoc:=glGetUniformLocation(Shader.ProgramHandle,PChar('projMatrix'));
  ViewMatrixLoc:=glGetUniformLocation(Shader.ProgramHandle,PChar('viewMatrix'));
  Shader.Activate;
  glUniformMatrix4fv(ProjMatrixLoc,1,false, @ProjMatrix.S[0]);
  glUniformMatrix4fv(ViewMatrixLoc,1,false, @ViewMatrix.S[0]);

and this is what it looks like in action
notice the public keyword separating the comands from the fields there has to be a keyword to separate them or it won't compile 

Code: [Select]
  Matrix.C[0].XYZW(1,2,3,4);
  Matrix.C[0].X:=2;
  Matrix.D[vx,vx]:=1;
  Matrix.S[15]:=10;

a few more examples to show you the different ways we can use this matrix

 

TinyPortal © 2005-2018