forked from fnec/opengloberon
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUnix.WMGLWindow.Mod
More file actions
83 lines (65 loc) · 1.54 KB
/
Unix.WMGLWindow.Mod
File metadata and controls
83 lines (65 loc) · 1.54 KB
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
79
80
81
82
83
MODULE WMGLWindow; (** AUTHOR "fnecati"; PURPOSE "an OpenGL Context enabled WM.Window using GLXPixmap for LinuxAos"; *)
IMPORT
WM := WMWindowManager, KernelLog, GLContext;
CONST debug = FALSE;
TYPE Context = GLContext.Context;
TYPE
Window* = OBJECT(WM.DoubleBufferWindow)
VAR
context : Context;
PROCEDURE &Init*(w, h: SIZE; alpha: BOOLEAN);
BEGIN
Init^(w, h, alpha); (* use alpha, for 32bpp img *)
NEW(context);
context.Init( w, h);
END Init;
(** *)
PROCEDURE Close*();
BEGIN
context.Close();
(* context := NIL; *)
Close^;
END Close;
PROCEDURE MakeCurrent*();
BEGIN
context.MakeCurrent();
END MakeCurrent;
PROCEDURE DeActivate*();
BEGIN
context.DeActivate();
END DeActivate;
PROCEDURE SwapGLBuffer*();
BEGIN
context.RenderInto(backImg);
END SwapGLBuffer;
PROCEDURE Reshape*(w,h: SIZE);
END Reshape;
PROCEDURE UpdateImage*();
END UpdateImage;
PROCEDURE Resized(w, h: SIZE);
BEGIN
IF debug THEN
KernelLog.String("wmglwindow.resized w, h = "); KernelLog.Int(w, 0); KernelLog.Int(h, 10); KernelLog.Ln;
END;
context.Resize(w, h);
ReInit(w, h);
Reshape(w, h);
UpdateImage;
END Resized;
PROCEDURE GetDisplay*(): ADDRESS;
BEGIN
RETURN context.GetDisplay();
END GetDisplay;
PROCEDURE GetContext*(): ADDRESS;
BEGIN
RETURN context.GetContext();
END GetContext;
PROCEDURE GetScreen*(): SIGNED32;
BEGIN
RETURN 0; (*context.glWin.screen *)
END GetScreen;
END Window;
BEGIN
END WMGLWindow.
System.Free WMGLWindow ~
System.FreeDownTo OpenGL ~