Re: [fpc-pascal] PTCGraph resolution detection

2024-03-19 Thread Nikolay Nikolov via fpc-pascal


On 3/19/24 18:15, James Richters via fpc-pascal wrote:


I am trying to compile a program that uses PTCGraph for Windows 64 
bit, and it’s not behaving the same as it does on Win32.


When I compile it for Win32, it is correctly detecting my monitor 
resolutionI have a vertical monitor with a resolution of 1080x2560


When I run the Win32 program I correctly get:

Max resolution:1080x2560

The 64bit version incorrectly produces:

Max resolution:2160x3840

I tried it on another computer with a 1280x1024 monitor and it 
correctly identifies it on both versions.


Below is the procedure that gets the monitor resolution.

I am using the current trunk of FPC installed today.

Does anyone have any idea why the 64bit version would work differently 
than the 32bit version?


James

No idea, but it does sound like a Windows issue to me. Or a video card 
driver issue? The API is the same. The mechanism for obtaining the list 
of resolutions is also the same. Perhaps Microsoft uses a fake 
DirectDraw shim in 64-bit Windows that presents a fake resolutions list, 
because they can? Perhaps it is an issue, related to the video card 
drivers? What are the video cards on the two machines that you have tested?


Nikolay


Uses

Windows,ptcgraph,ptccrt,crt,sysutils;

Procedure WindowsGRAPHINIT;

Var

gd,gm:smallint;

m: PModeInfo;

graphinitialize,MaxX,MaxY:Integer;

Begin

Windowtitle:='ptcgraph';

graphinitialize:=1234;

MaxX:=0;

MaxY:=0;

m := QueryAdapterInfo;

while m <> nil do

begin

If m^.MaxX+1>MaxX then

MaxX:=m^.MaxX+1;

If m^.MaxY+1>MaxY then

MaxY:=m^.MaxY+1;

m := m^.next;

end;

Writeln ('Max resolution:',MaxX,'x',MaxY);

gd:=VESA;

gm:=InstallUserMode(WindowXResolution,WindowYResolution,65536,1,1,1);

If gm<0 Then

Begin

Writeln('Error Installing Graphics ',gm,' ',grapherrormsg(gm));

Halt(70);

End;

PtcGraph.InitGraph(gd,gm,'');

… snip …


___
fpc-pascal maillist  -fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] PTCGraph resolution detection

2024-03-19 Thread James Richters via fpc-pascal
I am trying to compile a program that uses PTCGraph for Windows 64 bit, and
it's not behaving the same as it does on Win32.
When I compile it for Win32, it is correctly detecting my monitor resolution
I have a vertical monitor with a resolution of 1080x2560  
 
When I run the Win32 program I correctly get:
Max resolution:1080x2560 
 
The 64bit version incorrectly produces:
Max resolution:2160x3840 
 
I tried it on another computer with a 1280x1024 monitor and it correctly
identifies it on both versions.
 
Below is the procedure that gets the monitor resolution.
 
I am using the current trunk of FPC installed today. 
 
Does anyone have any idea why the 64bit version would work differently than
the 32bit version?
 
James
 
 
 
Uses
   Windows,ptcgraph,ptccrt,crt,sysutils;
 
 
Procedure WindowsGRAPHINIT;
 
Var
gd,gm:smallint;
m: PModeInfo;
graphinitialize,MaxX,MaxY:Integer;
Begin
   Windowtitle:='ptcgraph';
   graphinitialize:=1234;
   MaxX:=0;
   MaxY:=0;
   m := QueryAdapterInfo;
   while m <> nil do
  begin
 If m^.MaxX+1>MaxX then
MaxX:=m^.MaxX+1;
 If m^.MaxY+1>MaxY then
 MaxY:=m^.MaxY+1;
 m := m^.next;
  end;
   Writeln ('Max resolution:',MaxX,'x',MaxY);
   gd:=VESA;
 
gm:=InstallUserMode(WindowXResolution,WindowYResolution,65536,1,1,1)
;
   If gm<0 Then
  Begin
 Writeln('Error Installing Graphics ',gm,' ',grapherrormsg(gm));
 Halt(70);
  End;
   PtcGraph.InitGraph(gd,gm,'');
. snip .
 
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal