rev: 3827f53bae88e48a594610914ba74b9512ead6dd tukan/testing/test_dockgui.sc -rw-r--r-- 1.5 KiB View raw Log this file
3827f53bae88 — Leonard Ritter * more work on module system 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env scopes

using import ..tukan.GLMain
using import ..tukan.Screen
using import ..tukan.DockGUI

using import ..tukan.gl
using import glm
using import glsl
using import ..tukan.imgui

let glmain =
    GLMain
        title = "DockGUI"
        width = 800
        height = 600
        resizable = true

let screen = (Screen)

inout uv : vec2 (location = 0)
#inout pos : vec2 (location = 1)

let vertex-fn =
    do
        fn main ()
            uv.out =
                ((Screen.set-vertex-position) * 0.5) + 0.5
            return;
let fragment-fn =
    do
        out out_Color : vec4
        uniform phase : f32
            location = 0

        fn make-phase ()
            #(sin phase) * 0.5 + 0.5
            0.5

        fn main ()
            out_Color = (vec4 (deref uv.in) (make-phase) 1)
            return;

#let pg = (GL.CreateProgram)
#let link =
    attach-shaders pg
        vertex-stage = vertex-fn
        fragment-stage = fragment-fn
#link;

global test-window-visible = true
'append DockGUI.on-define-windows
    fn ()
        ShowDemoWindow test-window-visible

#global phase = 0.0
#'append GLMain.on-draw
    inline (time size glmain)
        GL.Viewport 0 0 size.x size.y
        GL.ClearColor 0 0 1 1
        GL.Clear
            |
                GL.COLOR_BUFFER_BIT
                GL.DEPTH_BUFFER_BIT
                GL.STENCIL_BUFFER_BIT

        GL.UseProgram pg
        GL.Uniform1f 0 phase
        phase = (phase + 0.1)
        'draw screen
        GL.UseProgram 0

let gui = (DockGUI glmain)

'run glmain

print "done."