[solved] Window.MaxWidth default at 4000

I was quite puzzled that whenever I go FullScreen on 4k display, there’s a border on the right side. I typically test on lower, windowed resolutions so I didn’t pay much attention to it so far. Apparently, the TCastleWindow has a default value MaxWidth = 4000, same for MaxHeight. I know it’s described in documentation but I never knew I’d have to check the meaning of the Width property :laughing:

The 4k displays are 4096 pixels, so it’s just little bit more than the default, and now I know I have to change it for every new app. But if it isn’t too much to ask for, could that value be changed in the CGE source (CastleWindow.pas) to better reflect modern display capabilities? I know you’re busy with other TODOs, so I don’t push, it’s just a small QoL thing anyway.

Ha, nice catch, thank you :slight_smile: I changed it to 1000 * 1000 now ( Increase default TCastleWindow.MaxWidth/Height to be million (1000 * … · castle-engine/castle-engine@85a85d6 · GitHub ).

I set this limit “4000” many years ago, probably thinking “4000 is well beyond the possible resolution of any existing monitor” :slight_smile: 4k displays didn’t exist back then probably, or I didn’t know about them. ( The whole reason why we need a non-zero number there at all is internal, we should instead allow “0” there to mean “no limit”, it would be cleaner. Some day I shall improve it. )

1 Like

I didn’t have a chance to check if that works any earlier - kind of holiday. But when I finally did… it doesn’t work :face_with_monocle:

Reason:

{ TCastleWindow ---------------------------------------------------------- }

constructor TCastleWindow.Create(AOwner: TComponent);
...
  minWidth := 100;      --->  maxWidth := 4000;
  minHeight := 100;     --->  maxHeight := 4000;

And while you’re inside the CastleWindow.pas. I see that OpenCore has

    if ( (AntiAliasing = aa2SamplesNicer) or
         (AntiAliasing = aa4SamplesNicer) ) and
       GLFeatures.NV_multisample_filter_hint then
      glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST);

I’m not an expert in openGL, but shouldn’t aa8 / aa16 SamplesNicer be also included in the OR list? Or maybe the Nicest/Faster could be a property, but I like them being simple constants :slight_smile:

Ups, thanks for catching, looks like I made a rookie mistake :slight_smile: And not even a month ago I was warning about this mistake at modern Pascal course.

Fixed in Fix default TCastleWindow.MaxWidth/Height · castle-engine/castle-engine@2366e4c · GitHub .

Thanks again, fixed in https://github.com/castle-engine/castle-engine/commit/0190463440e4fdd287ed211a4b63c1b0884e4d35 .