Recent

Author Topic: graph unit future plans?  (Read 3161 times)

Weiss

  • Full Member
  • ***
  • Posts: 127
graph unit future plans?
« on: January 01, 2024, 10:13:27 pm »
I noticed there is Graph unit maintenance, among FP future plans. I thought “deprecated” means it was left to rot and eventually disappear. I am still using plotting and graphic interfaces I made with graph unit. Not just using, but adding to it on occasion. I am glad to see it in future plans, Graph is convenient, for quick tests and such.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: graph unit future plans?
« Reply #1 on: January 01, 2024, 10:42:44 pm »
Deprecated means not meant for new development. But the future plans on the website is really old (as in almost two decades), and only marginally updated. Don't take it as gospel.

However since those plans were written, a new maintainer has invested in many things DOS, including a 16-bit backend, though most work seems to go into the "ptcgraph" unit.


Thaddy

  • Hero Member
  • *****
  • Posts: 14375
  • Sensorship about opinions does not belong here.
Re: graph unit future plans?
« Reply #2 on: January 02, 2024, 02:02:27 pm »
ptcGraph is quite compatible, though.
« Last Edit: January 05, 2024, 05:04:11 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Weiss

  • Full Member
  • ***
  • Posts: 127
Re: graph unit future plans?
« Reply #3 on: January 04, 2024, 09:00:45 pm »
I keep hearing about ptcGraph, where is it? Also documentation seem to be obscured, if existing, I keep finding reference to graph unit whenever I look for ptcGraph.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: graph unit future plans?
« Reply #4 on: January 04, 2024, 09:17:13 pm »
Afaik ptcgraph is a graph compatible on top of the PTCpas drawing library.

Josh

  • Hero Member
  • *****
  • Posts: 1274
Re: graph unit future plans?
« Reply #5 on: January 04, 2024, 09:29:38 pm »
it should be built in

..\fpcsrc\packages\graph\src\ptcgraph

add ptcGraph to your uses statement.

documentation not surewhere to find

The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Nitorami

  • Sr. Member
  • ****
  • Posts: 496
Re: graph unit future plans?
« Reply #6 on: January 04, 2024, 10:38:11 pm »
I used ptcgraph a lot in console programs because it is MUCH faster than graph and practically 100% compatible. Just exchange "uses graph" by "uses ptcgraph". It should be under \units\...graph. It depends on ptc, hermes, GLext and a few more so you'll need to tell the compiler where to find all those but once that is done, it works like a charm.

Weiss

  • Full Member
  • ***
  • Posts: 127
Re: graph unit future plans?
« Reply #7 on: January 05, 2024, 04:23:44 am »
I don’t know if I need speed from ptcGraph, Graph is already fast and responsive, runs circles around canvas and forms. Sometimes I wonder if I should build the entire interface in Graph, as I did not long ago. The whole application ended up 600 kilobyte. As opposite to 25Mb for same functionality.

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • UVviewsoft
Re: graph unit future plans?
« Reply #8 on: January 05, 2024, 09:03:02 am »
Improved the wiki page https://wiki.freepascal.org/ptc

Darie

  • New Member
  • *
  • Posts: 31
Re: graph unit future plans?
« Reply #9 on: March 05, 2024, 03:06:28 pm »
I was wondering (as a side note, maybe I should open another thread for this question) - if there are any graph units linking directly against OpenGL (so that can be rendered on a *nix system without X installed) as in this article: https://developer.nvidia.com/blog/linking-opengl-server-side-rendering/

Context: I am teaching my child programming on an old Asus EeePC (Atom CPU, 2G RAM) with a text-only linux install.

Also, as a second side note, under Ubuntu 23.10 (Win11 works fine) in FP 3.2.2, for ptccrt & ptcgraph I have to specify cthreads as the first used unit or the program fails with:
Code: [Select]
Threading has been used before cthreads was initialized.
Make cthreads one of the first units in your uses clause.
Runtime error 211 at $00000000004BE21D $00000000004BE21D $0000000000425BEC

Thank you!

PS: Just in case, here's the program:
Code: Pascal  [Select][+][-]
  1. PROGRAM
  2.   RandomGraph;
  3. USES
  4. {$IFDEF UNIX}
  5.   cthreads,
  6. {$ENDIF}
  7.   ptccrt,
  8.   ptcgraph;
  9. CONST
  10.   x = 640;
  11.   y = 480;
  12.   col = 256;
  13.   deg = 360;
  14. VAR
  15.   gd, gm, ret: integer;
  16.   b: byte;
  17. BEGIN
  18.   gd := D8bit;
  19.   gm := m640x480;
  20.   initgraph(gd, gm, '');
  21.   ret := graphresult();
  22.   if ret <> grOK then
  23.   begin
  24.     write(grapherrormsg(ret));
  25.     halt;
  26.   end;
  27.  
  28.   randomize;
  29.   b := random(11);
  30.   repeat
  31.     setcolor(random(col));
  32.     case b of
  33.       0: putpixel(random(x), random(y), random(col));
  34.       1: circle(random(x), random(y), random(col));
  35.       2: line(random(x), random(y), random(x), random(y));
  36.       3: hline(random(x), random(x), random(y));
  37.       4: vline(random(x), random(y), random(y));
  38.       5: arc(random(x), random(y), random(deg), random(deg), random(col));
  39.       6: bar3d(random(x), random(y), random(x), random(y), random(col), false);
  40.       7: ellipse(random(x), random(y), random(deg), random(deg), random(col), random(col));
  41.       8: rectangle(random(x), random(y), random(x), random(y));
  42.       9: lineto(random(x), random(y));
  43.       otherwise linerel(random(x), random(y));
  44.     end;
  45.   until keypressed;
  46.  
  47.   closegraph;
  48. END.
  49.  

EDIT: to (partially) answer my question, I found SDL unit
https://www.freepascal.org/daily/packages/sdl/index-8.html
https://wiki.libsdl.org/SDL2/Installation
https://www.freepascal-meets-sdl.net/
and ZenGL https://sourceforge.net/p/new-zengl/wiki/Home/ https://github.com/Seenkao/New-ZenGL
which could be a starting point for those who ask themselves the same question :)

EDIT2: Thank you @Roland57 for mentioning https://sdl-bgi.sourceforge.io with https://github.com/JulStrat/ubgi !
°) I have installed and tested this solution on two different Ubuntu 23.10 installs, one with X the other without. The example above, modified for the graph mode init, on the X system works flawlessly. On the other hand, the headless install does not halt on keypressed leaving the system non-responsive to all key presses, having to push the shutdown button to halt the computer.
°) In the USES section of the program the order in which the units are specified matters, so it needs to be ubgi, crt for the keypress to work correctly under different circumstances.
°) Also, there is no hLine, vLine implementation.
°) The bar3D implementation has an integer as the last parameter ( not boolean as usual )
°) lineRel is behaving abnormaly.
NOTE: ubgi is waaaaaaaay slower than the other graph units.

PPS: Sorry @Weiss for having "hijacked" your thread  :-\
« Last Edit: March 06, 2024, 09:52:38 pm by Darie »
The sphere of knowledge is in continuous expansion. So is the contact of it's points with the unknown --Blaise Pascal

TRon

  • Hero Member
  • *****
  • Posts: 2523
Re: graph unit future plans?
« Reply #10 on: March 05, 2024, 08:53:03 pm »
I was wondering (as a side note, maybe I should open another thread for this question) - if there are any graph units linking directly against OpenGL
Package PTC (indeed, the same ptc as in ptcgraph) has support for GL.

Darie

  • New Member
  • *
  • Posts: 31
Re: graph unit future plans?
« Reply #11 on: March 05, 2024, 08:58:44 pm »
I was wondering (as a side note, maybe I should open another thread for this question) - if there are any graph units linking directly against OpenGL
Package PTC (indeed, the same ptc as in ptcgraph) has support for GL.

Indeed, it does. But the unit is linked against x.org not directly to open.gl so the system on which is running must have X installed.
The sphere of knowledge is in continuous expansion. So is the contact of it's points with the unknown --Blaise Pascal

TRon

  • Hero Member
  • *****
  • Posts: 2523
Re: graph unit future plans?
« Reply #12 on: March 05, 2024, 09:07:17 pm »
Indeed, it does. But the unit is linked against x.org not directly to open.gl so the system on which is running must have X installed.
Indeed it does. I missed that part :-[ Sorry for that.

Darie

  • New Member
  • *
  • Posts: 31
Re: graph unit future plans?
« Reply #13 on: March 05, 2024, 09:12:26 pm »
No prob, thanks for the answer & thanks for the interest. These are questions that could make life easier for everyone :)
The sphere of knowledge is in continuous expansion. So is the contact of it's points with the unknown --Blaise Pascal

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: graph unit future plans?
« Reply #14 on: March 05, 2024, 09:37:44 pm »
In the early 2000s there were svgalib and ggigraph as graph backends.  Haven't seem them used for a while (as all non X/wayland graphics)
« Last Edit: March 06, 2024, 08:44:10 am by marcov »

 

TinyPortal © 2005-2018