Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash: if monitor scale is below 1.0, then line-width in *drawing-settings* is 0.0 #265

Open
bymoz089 opened this issue Oct 23, 2024 · 0 comments

Comments

@bymoz089
Copy link

(kons-9:run) crashes after creating the Opengl-Window if monitor scaling setting is below 1.0 (below 100).

description

With that monitor scaling setting

(floor (first (glfw:get-monitor-content-scale (glfw:get-primary-monitor))))

return 0.0, this value is in function show-window then setf'd to monitor-scale of drawing-settings. This makes a lot of width calculations later invalid, due to multiplicating values with 0.0.

e.g. all values folowing function from opengl.lisp get the value 0.0:

(defun set-lines-thin ()
  (setf (point-size *drawing-settings*) (* 3.0 (monitor-scale *drawing-settings*)))
  (setf (line-thickness *drawing-settings*) (* 1.0 (monitor-scale *drawing-settings*)))
  (setf (axes-thickness *drawing-settings*) (* 3.0 (monitor-scale *drawing-settings*)))
  (setf (secondary-line-thickness *drawing-settings*) (* 0.5 (monitor-scale *drawing-settings*))))

this eventually makes kons-9 crashing after initial window is created:

An unhandled error condition has been signalled:
   OpenGL signalled (1281 . INVALID-VALUE) from LINE-WIDTH.

proposed fix

replace

(setf (monitor-scale *drawing-settings*)
      (floor (first (glfw:get-monitor-content-scale (glfw:get-primary-monitor)))))

with:

(setf (monitor-scale *drawing-settings*)
      (max (floor (first (glfw:get-monitor-content-scale (glfw:get-primary-monitor)))) 1.0))

in function show-window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant