[fpc-pascal] Implementing AggPas with PtcGraph
James Richters
james at productionautomation.net
Wed Jun 14 17:37:49 CEST 2017
I was able to finally compile and run the test program for Win64. I wanted to change only one thing at a time so I could figure out what exactly the problem was. The first thing I tried was to use the exact version of AggPas Graeme used.
>As for AggPas. I use the version of AggPas that is included with fpGUI.
>I simply make sure the path to AggPas is specified in the project compiler settings, which in the above command line parameter is:
> c:\devel\fpgui\src\corelib\render\software
Previously I was using the only version of AggPas I could find by doing an internet search which I downloaded from here:
http://www.crossgl.com/aggpas/aggpas-download.htm then downloaded AggPas24-rm3.zip
So I removed that version and downloaded fpgui_src_1.4.1.zip from:
https://sourceforge.net/projects/fpgui/files/fpGUI/1.4.1/
I extracted it to my H: Drive and tested it out.
I did not change my path for this test so I just put in paths to everything and ran it from the H:\FPC64\3.0.2\x86_64-win64\bin directory then executed the following command line:
fpc -Fu..\units\$fpctarget\* -FuH:\fpgui-1.4.1\src\corelib\render\software J:\programming\Gcode\Graphics\aggpas_ptcgraph_output.pas
The compile was successful and the Win64 version of the program ran fine.
So just for fun, I replaced the aggpas units in my original setup with the ones from fpgui_src_1.4.1.zip and tried it the original way I was doing it with the cross compiler and the command:
fpc -FuJ:\Programming\FPC\3.0.2\units\$fpctarget\* -Px86_64 aggpas_ptcgraph_output.pas
This was also successful, so I tried a few other sample programs and they all seem to work as both Win32 and Win64
So I was wondering, why would this be? So I looked at this:
>While in lazarus open agg_rasterizer_scanline_aa.pas, go ro line 611 press Ctr and click on ptrcomp. It should open agg_basics.pas, the comment may apply to your situation.
And did a compare between agg_basics from AggPas24-rm3.zip and agg_basics from fpgui_src_1.4.1.zip and noticed they are NOT the same. They both indicate they are the same by the comments at the top
// Anti-Grain Geometry - Version 2.4 Release Milano 3 (AggPas 2.4 RM3)
But the version from AggPas24-rm3.zip has
// Pascal's pointer-in-an-array-access helper structures
p32_ptr = ^p32;
p32 = record
case integer of
1 : (ptr : pointer );
{$IFDEF CPU64 }
2 : (int : system.int64 );
{$ELSE }
2 : (int : integer );
{$ENDIF }
end;
while the version from fpgui_src_1.4.1.zip has
// Pascal's pointer-in-an-array-access helper structures
p32_ptr = ^p32;
p32 = record
case integer of
1 : (ptr : pointer );
2 : (int : ptrcomp );
end;
There are also several other differences in the 2 files.
So it looks like AggPas24-rm3.zip from http://www.crossgl.com/aggpas/aggpas-download.htm was last updated in 2008, while
FPGUI was updated in 2015 and the version there has had some changes so it is now beyond 24-rm3. Very confusing. Maybe AggPas is not being maintained anymore at http://www.crossgl.com/aggpas ?
Anyway Thank you to everyone for helping get to the bottom of this!
-----Original Message-----
From: fpc-pascal [mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Graeme Geldenhuys
Sent: Wednesday, June 14, 2017 8:29 AM
To: fpc-pascal at lists.freepascal.org
Cc: James Richters <james at productionautomation.net>
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph
On 2017-06-14 11:57, James Richters wrote:
> I've downloaded the zip file and extracted it to H:\FPC64. But now
> I have a few questions to attempt to duplicate a successful 64bit
> compile.
Two steps are required - sorry, I forgot to mention that in my previous post (though I did to the person i created this zip for originally).
1) I find it always useful to have the <fpc>\bin\ directory in my PATH so that the fpc.exe executable can be run from anywhere.
2) You need to adjust the fpc.cfg file (located in the 'bin' directory) to match your install path. My path was:
c:\lazarus\fpc\3.0.2\x86_64-win64
Back in FPC 2.4.x I installed Lazarus which included FPC, which in turn installed the FPC under the c:\lazarus\fpc\ directory. Ever since every FPC update, I just stuck to that install location. So you don't need to have it like this obviously.
> Maybe it isn't valid to use the IDE with Win64? I sure wish it would
> work. I like and prefer the FPC text IDE.
The FPC Text IDE (64-bit) runs just fine here under Windows 7 64-bit.
See attached screenshot. Even mouse support works inside the Text IDE.
I mostly use MSEide for all my console, web and fpGUI related programming. I created some custom project templates and away I go.
Lazarus has some nice editor features, but is often buggy and the Lazarus Package system just doesn't work for me. With MSEide I use global (or per project) path macros instead. This gives much more reliable compilations.
Here is the command line equivalent of what my MSEide project does for the ptcgraph + aggpas demo.
C:\lazarus\fpc\3.0.2\x86_64-win64\bin\fpc.exe
-oaggpas_ptcgraph_output.exe -Fuc:\devel\fpgui\src\reportengine
-Fuc:\devel\fpgui\src\corelib\render\software
-Fic:\devel\fpgui\src\corelib\render\software -Fic:\devel\fpgui\src -Fuc:\devel\fpgui\src\corelib\gdi -Fic:\devel\fpgui\src\corelib\gdi -Fuc:\devel\fpgui\src\gui -Fuc:\devel\fpgui\src\corelib -l -Mobjfpc -Sh -Sc -Si -gl -O- -FUunits -viewnh aggpas_ptcgraph_output.pas
As for AggPas. I use the version of AggPas that is included with fpGUI.
I simply make sure the path to AggPas is specified in the project compiler settings, which in the above command line parameter is:
c:\devel\fpgui\src\corelib\render\software
FPC then compiles all units as it needs them, and I always output the compiled units into a project specific "units" directory (the -FUunits command line parameter seen above). I don't like mixing *.pas and *.o;*.ppu files in the same directories.
> I also wonder if this is a windows 10 frootllooopy weirdness thing (it
> wouldn't be the first). Can you just email me the exe file zipped and
> l'll just try to run it here? Then I will know if it's a compiler
> issue or an OS issue
I assume you mean the executable of the ptcgraph+aggpas demo? I'll do so in a private email.
Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
My public PGP key: http://tinyurl.com/graeme-pgp
More information about the fpc-pascal
mailing list