[fpc-pascal] GLPT v0.1.1 released

Anthony Walter sysrpl at gmail.com
Thu Oct 11 16:17:55 CEST 2018


I haven't tried your package yet since I really don't want to boot into
Windows, but I looked at your source code in the git repository.

Off the top of my head here are just a  few questions or suggestions you
need to implement to make it useful:

1) I don't see any code to enumerate the supported screen resolutions
2) I don't see any code to toggle a window exclusive mode
3) I don't see any code to abstract loading OpenGL or extensions
  3a) You should provide a function to return either the OpenGL library
name based on the Context requested, or a handle to the library so that
GetProcAddress can be called
  3b) You should provide a platform independent function to load extensions
by name
4) Your get time function is incredibly inaccurate. You should be using
QueryPerformanceCounter on Windows and clock_gettime on Linux and Mac.

function GetTime should look something like this:

var
  BaseTime: Double = 0;

{$ifdef windows}
function GetTime: Double;
var
  Resolution, Counter: Int64;
begin
  QueryPerformanceFrequency(Value);
  Resolution := Resolution div 1000;
  QueryPerformanceCounter(Counter);
  Result := Counter / Resolution / 1000;
  if BaseTime = 0 then
    BaseTime := Result;
  Result := Result - BaseTime;
end;
{$else}
function GetTime: Double;
const
  CLOCK_MONOTONIC = 1;
  Nanosecond = 1 / 1000000000;
var
  T: TTimeSpec;
begin
  clock_gettime(CLOCK_MONOTONIC, @T);
  Result := T.tv_sec + T.tv_nsec * Nanosecond;
  if BaseTime = 0 then
    BaseTime := Result;
  Result := Result - BaseTime;
end;
{$endif}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20181011/31c419d2/attachment.html>


More information about the fpc-pascal mailing list