[fpc-pascal] Implementing AggPas with PtcGraph
james at productionautomation.net
Tue Jun 13 22:44:42 CEST 2017
>I've tested the example on 64 bit linux as a native application as well cross compiled for a x86_64 windows target. Worked fine in both Wine and on a Win64 machine.
>In my experience, the one dependency that AggPas has potential to fail may be related to the freetype library. If you plan to run your app on windows only, then you can turn freetype off and
>AggPas will happily use windows font libraries. Search for the AGG2D_USE_FREETYPE define and comment it out.
I thought I would try to compile the example for x86_64, because I would eventually like to make my final program an x86_64 program.
When I compile it with the command:
fpc -Fu'J:\programming\fpc\3.0.2\units\$fpctarget\*' aggpas_ptcgraph_output.pas
it works fine.
When I try
fpc -Fu'J:\programming\fpc\3.0.2\units\$fpctarget\*' -Px86_64 aggpas_ptcgraph_output.pas
it compiles fine with no errors, and it executes with no errors, however I do not get any output in either window at all, they are both just black, and unresponsive.
I've commented out the AGG2D_USE_FREETYPE for now, because I'm not sure if the freetype.dll I have will work on 64bit programs, and thought I would eliminate that as a possible issue.
I am using FPC v3.0.2 on a windows 10 x64 machine
I normally use the freepascal IDE to compile my programs, so I'm not too familiar with compiling from the command line. I'm wondering if I am doing something wrong.
Also, is there some way to set a default for my units so I don't have to use Fu'J:\programming\fpc\3.0.2\units\$fpctarget\*' all the time? If I don't use that, then it can't find any units, even though it's set in the directories with the IDE
I have some other sample programs that use ptcgraph (without AggPas) that do not have this issue, they compile as 64bit programs and run fine. This seems to be something with using AggPas that appears to be causing the problem. I put in a writeln('test'); at the beginning of the program and it does do that, and I move ptcgraph.Rectangle(10,10,100,100); to before drawstuff(agg); I will get the rectangle on the graph screen. So I thought I would try to narrow down what was happening by drawing different rectangles in the middle of the code like this:
agg^.clearAll(0, 0, 0);
agg^.lineColor(0, 0, 0, 255);
agg^.rectangle(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
agg^.lineColor(0, 155, 0, 255);
agg^.rectangle(10, 10, 50, 50);
I get the first rectangle right away, the second rectangle after 6 seconds, and the third after 6 more seconds.
I tried commenting out everything else, but I still never get the image from putimage();
I'm very confused by this and don't have a clue what could be wrong. If I take out the -Px86_64 in the compile command line, the program runs as expected. Since Stefan said he compiled 64bit versions of the example program and it worked, I wonder why I am having this issue.
More information about the fpc-pascal