Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@bymoz089

Description

@bymoz089

(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions