No matching definitions.

opengl/window

src/opengl/window.tur
defn

make-window

(make-window [width : int height : int title : cstr] :)

open a GLFW window and initialise an OpenGL 3.3 Core context.

widthwindow width in pixels
heightwindow height in pixels
titlewindow title string

Opaque :int window handle. Calls exit(1) on failure.

(let [w (make-window 800 600 "My App")] ...)

Since: v0.1.0

defn

destroy-window

(destroy-window [w : int] :)

destroy a GLFW window and terminate the GLFW runtime.

wwindow handle returned by make-window
(destroy-window w)

Since: v0.1.0

defn

window-should-close?

(window-should-close? [w : int] :)

return true if the user requested window close.

wwindow handle

true if the close button was clicked or ESC was pressed.

(while (not (window-should-close? w)) ...)

Since: v0.1.0

defn

poll-events

(poll-events :)

process pending window and input events.

(poll-events)

Since: v0.1.0

defn

swap-buffers

(swap-buffers [w : int] :)

present the rendered frame to the screen.

wwindow handle
(swap-buffers w)

Since: v0.1.0

defn

set-clear-color

(set-clear-color [r : float g : float b : float a : float] :)

set the color used by clear.

rred channel (0.0-1.0)
ggreen channel (0.0-1.0)
bblue channel (0.0-1.0)
aalpha channel (0.0-1.0)
(set-clear-color 0.1 0.1 0.1 1.0)

Since: v0.1.0

defn

clear

(clear :)

clear the color and depth buffers.

(clear)

Since: v0.1.0

defmacro

with-window

(with-window [w width height title & body])

open a window, execute body, then destroy the window.

wsymbol to bind the :int window handle
widthwindow width in pixels
heightwindow height in pixels
titlewindow title string
bodyone or more expressions executed with w in scope
(with-window w 800 600 "Demo"
    (set-clear-color 0.1 0.1 0.1 1.0)
    (while (not (window-should-close? w))
      (clear)
      (swap-buffers w)
      (poll-events)))

Since: v0.1.0