Several questions about ptcGraph lazarus / 39-Graphics ---------------------------------------------------------------------- Roland57 · 2020-10-28 06:44 Hello! My first question is about the modification proposed here, in order to fix a small memory leak in ptcGraph. Who should you contact so that the modification is possibly integrated in a future version of Free Pascal? I have another question, about the third parameter of the InitGraph procedure. As far as I know, this parameter is not used. So, why not use it to set the value of the WindowTitle variable? Like in the WinGraph unit. Regards. Roland ---------------------------------------------------------------------- Roland57 · 2020-10-28 07:51 I have a third question.  Is safe to use the values given by the little program that I posted here? Is it safe, for example, to do as follows: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  grDriver, grMode: smallint;  begin  grDriver := VESA; grMode := 258;  WindowTitle := 'My title';  InitGraph(grDriver, grMode, ''); Will the value 258 have the same meaning on all systems? Quote        10      258    800x600       16     800 x 600 VESA ---------------------------------------------------------------------- Roland57 · 2020-10-28 08:47 I try to convert little examples that I had made for the WinGraph unit. I miss two things. 1° The CloseGraphRequest function. How can I know that the user clicked on the close button of the window? 2° The procedure UpdateGraph, which is used as follows: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   UpdateGraph(UpdateOff);  { Drawing operations }  UpdateGraph(UpdateOn);  { or }  UpdateGraph(UpdateNow); Is there a way to do that with ptcGraph? ---------------------------------------------------------------------- PascalDragon · 2020-10-28 09:04 Quote from: Roland57 on October 28, 2020, 07:44:11 amMy first question is about the modification proposed here, in order to fix a small memory leak in ptcGraph. Who should you contact so that the modification is possibly integrated in a future version of Free Pascal? Please report on the Bug Tracker. Quote from: Roland57 on October 28, 2020, 07:44:11 amI have another question, about the third parameter of the InitGraph procedure. As far as I know, this parameter is not used. So, why not use it to set the value of the WindowTitle variable? Like in the WinGraph unit. For FPC's Graph system the third parameter is the path to the BGI fonts and that is used by InitGraph. So no. Quote from: Roland57 on October 28, 2020, 08:51:08 amWill the value 258 have the same meaning on all systems? As long as you use the same Graph implementation unit. They might differ between e.g. Graph and PtcGraph. In case of the Graph unit itself they might even differ between systems (cause strictly they are not the same units between systems then). Quote from: Roland57 on October 28, 2020, 09:47:21 am1° The CloseGraphRequest function. How can I know that the user clicked on the close button of the window? I don't think that PTC supports such functionality. Quote from: Roland57 on October 28, 2020, 09:47:21 am2° The procedure UpdateGraph, which is used as follows: What exactly does that do? What kind of updates are disabled then? ---------------------------------------------------------------------- Roland57 · 2020-10-28 09:14 @PascalDragon Thank you for this very informative answer. Quote from: PascalDragon on October 28, 2020, 10:04:30 amWhat exactly does that do? What kind of updates are disabled then? It's for deciding when the window is repaint. Quote from: PascalDragon on October 28, 2020, 10:04:30 amI don't think that PTC supports such functionality. I discovered that if I do this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses{$IFDEF UNIX}  CThreads,{$ENDIF}  SysUtils, ptcGraph, ptcCrt;  var  d, m: smallint;  begin  d := VGA;  m := VGAHi;  WindowTitle := 'Hello';  InitGraph(d, m, '');    repeat    Sleep(50);  until Ord(ReadKey) = 3;    CloseGraph;end. the user can close the window. Why 3, I don't know. ---------------------------------------------------------------------- PascalDragon · 2020-10-28 09:44 Quote from: Roland57 on October 28, 2020, 10:14:00 amQuote from: PascalDragon on October 28, 2020, 10:04:30 amWhat exactly does that do? What kind of updates are disabled then? It's for deciding when the window is repaint. That's not how the Graph system works. It's geared to be as compatible as the TP Graph unit as possible. Caching draws is explicitly not part of this. Quote from: Roland57 on October 28, 2020, 10:14:00 amthe user can close the window. Why 3, I don't know. That is in fact the intended behaviour. ---------------------------------------------------------------------- Roland57 · 2020-10-28 09:51 All questions solved. Thank you. I will make a report to the BugTracker (for the first point). Regards. Roland ---------------------------------------------------------------------- circular · 2020-10-28 11:12 I think it is char 3 because it is the value CTRL-C (third letter). In Dos programs, pressing CTRL-C terminates the program, so it makes sense that closing the window would be like sending this key. ---------------------------------------------------------------------- Roland57 · 2020-10-28 13:50 Quote from: circular on October 28, 2020, 12:12:14 pmI think it is char 3 because it is the value CTRL-C (third letter). In Dos programs, pressing CTRL-C terminates the program, so it makes sense that closing the window would be like sending this key. It makes sense. Quote from: Roland57 on October 28, 2020, 10:51:22 amI will make a report to the BugTracker (for the first point). Done. ---------------------------------------------------------------------- Brizeux · 2024-11-16 07:17 Dear Roland. I use ptcgraph, ptccrt, etc... for interoperability (windows, linux, raspbian) purpose and GrDriver = VESA ; GrMode = $107 ; for instance. My programs run more than x40 faster with ptcgraph ... than with old graph unit, thanks to Nicolai Nikolov. For pixels calculations by Monte-Carlo automata models ( 1 Atom == 1 Pixel ) I shall be interested by a mode m2560x1417x256c under ptc. Do you know if Nicolai plan to devellop this kind of mode for 4K UHD screen. It would be great  for Pascal works ! (*** PASCAL is the best for Scientific interactive calculations, far from ADA or Fortran ***) ---------------------------------------------------------------------- TRon · 2024-11-16 07:32 If I remember correctly ptcGraph allows for user defined graphic modes (installusermode) though I do not know for sure if that is the desired solution for what you ask for. ---------------------------------------------------------------------- Brizeux · 2024-11-16 08:34 Thanks TRon. In fact, I should be glad to have huge amount of graphical pixels under Ptc because I put the information on atoms only in the graphical memory by PutPixel and GetPixel, also I doesn't know if Nicolai Nikolov works on PtcGraph for 4K screen but it is not in my possibility to do that, because I am only a physicist. Friendly. Yves. P.S. But it is essential for Free Pascal to have a good graphical Ptc interactive system alive. For some linux like utilisation, it is necessary to use very old versions of Fpc system... ---------------------------------------------------------------------- TRon · 2024-11-16 09:18 It is a user function so there is no need to bother the developer  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program test; {$mode objfpc}{$h+} uses  {$ifdef unix} cthreads, {$endif}  ptcGraph,  ptcCrt; var  myCustomUserGraphMode : smallint;  grDriver            : smallint;  grMode                : smallint;  procedure setup;begin  myCustomUserGraphMode := InstallUserMode  (    1920,  // width in pixels    1080,  // height in pixels    256    // number of colors  );end;  begin  setup;   grDriver    := VESA;  grMode      := myCustomUserGraphMode;  WindowTitle := 'My title';  InitGraph(grDriver, grMode, '');   SetBkColor(white);  ClearViewPort;   SetFillStyle(SolidFill, lightgreen);  Bar(100, 100, 800, 500);   readkey;  CloseGraph;end. ---------------------------------------------------------------------- Brizeux · 2024-11-16 12:57 Merci beaucoup TRon, cela marche ! It is exactly what I need ! Thanks a lot . Yves . ---------------------------------------------------------------------- Brizeux · 2024-11-17 19:18 My opinion about PtcGraph is now accomplished : Beautiful and completely usefull for maintening FPC alive. With the help (thak you very much) of TRon   my program is finished for this topic. Y can use Screen memory to do all my interactive calculations at the Pixel level for m3840x2160x256c on the 4K UHD screen. Merci beaucoup. Yves . ---------------------------------------------------------------------- Roland57 · 2025-08-03 09:33 Quote from: PascalDragon on October 28, 2020, 10:44:41 amThat's not how the Graph system works. It's geared to be as compatible as the TP Graph unit as possible. Caching draws is explicitly not part of this. Hello PascalDragon (and other). Monthes later, I remember this discussion and I realize that what I was looking for, is simply SetActivePage and SetVisualPage functions. I made a simple example that I attach here, in case someone has the same question. @Brizeux Sorry, I didn't see your messages. Fortunately TRon answered to you. ---------------------------------------------------------------------- Brizeux · 2025-08-03 11:15 Merci Roland57. FPC-PASCAL 3.2.2 est excellent pour le calcul scientifique. Il remplace EXACTEMENT l'ancien FORTRAN II de nos IBM-1130 de 1966. Question simplicité il est préférable à ADA, PL/1, Modula pour des calculs purs et durs. ---------------------------------------------------------------------- Roland57 · 2025-08-03 11:25 Quote from: Brizeux on August 03, 2025, 01:15:10 pmMerci Roland57. FPC-PASCAL 3.2.2 est excellent pour le calcul scientifique. Il remplace EXACTEMENT l'ancien FORTRAN II de nos IBM-1130 de 1966. Question simplicité il est préférable à ADA, PL/1, Modula pour des calculs purs et durs. Intéressant. N'hésitez pas à partager des exemples de code sur le forum. ---------------------------------------------------------------------- TBMan · 2025-08-04 12:54 In one of my units I have the following code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit general;interfacetype  VideoPages = (Page0, Page1); var Page: VideoPages = Page0;  procedure Nextactivepage; procedure NextVisualPage;            implementationuses ptcgraph; procedure Nextactivepage;  begin    if page = page0 then page := page1    else    page := page0;       SetactivePage(Ord(Page));  end; procedure NextVisualPage;  begin    SetVisualpage(Ord(Page));  end;                         To see the next visual page, nextactivepage has to be called first. So calling NextVisualPage doesn't change the page variable. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i NextActivePage;           // set next page for drawingMyDrawingRoutine;      // do my screen writesNextVisualPage;        // show the page