-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathplGLUT.pl
executable file
·228 lines (195 loc) · 5.21 KB
/
plGLUT.pl
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
:- module(plGLUT,
[
glutCreateWindow/1,
glutDestroyWindow/0,
glutDisplayFunc/0,
glutFullScreen/0,
glutGet/2,
glutDisplayFunc/1,
glutIdleFunc/1,
glutInit/0,
glutInitDisplayMode/1,
glutInitWindowPosition/2,
glutInitWindowSize/2,
glutKeyboardFunc/0,
glutMainLoop/0,
glutMotionFunc/0,
glutMouseFunc/0,
glutPostRedisplay/0,
glutReshapeFunc/0,
glutReshapeWindow/2,
glutSetColor/4,
glutSolidCone/4,
glutSolidCube/1,
glutSolidSphere/3,
glutSolidTeapot/1,
glutSolidTorus/4,
glutSwapBuffers/0,
glutWireCone/4,
glutWireCube/1,
glutWireSphere/3,
glutWireTeapot/1,
glutWireTorus/4
]).
/** <module> GLUT Interface
This module is the glut extension of the Prolog OpenGL Interface
(plOpengL)
@author Jan Tatham
@license LGPL 2.1
*/
%% glutCreateWindow(+String)
% Creates a top-level window
glutCreateWindow(String):-
c_glutCreateWindow(String).
%% glutDestroyWindow
% Destroys the window
glutDestroyWindow:-
c_glutDestroyWindow.
%% glutDisplayFunc
% Sets the display callback for the current window.
glutDisplayFunc:-
c_glutDisplayFunc.
%% glutFullScreen
% Requests that the current window be made full screen.
glutFullScreen:-
c_glutFullScreen.
%% glutGet(+State, -Answer)
% Retrieves simple GLUT state represented by integers.
glutGet(State, Answer):-
c_glutGet(State, Answer).
%% glutDisplayFunc(+String)
% Requests that the current window be made full screen.
glutDisplayFunc(String):-
c_glutDisplayFunc(String).
%% glutIdleFunc(+String)
% Sets the global idle callback.
glutIdleFunc(String):-
c_glutIdleFunc(String).
%% glutInit
% Used to initialize the GLUT library.
glutInit:-
c_glutInit.
%% glutInitDisplayMode(+OptionList)
% Sets the initial display mode.
glutInitDisplayMode(OptionList):-
AppliedOptions is OptionList,
c_glutInitDisplayMode(AppliedOptions).
%% glutInitWindowPosition(+X, +Y)
% set the initial window position.
glutInitWindowPosition(X,Y) :-
Xs is X,
Ys is Y,
c_glutInitWindowPosition(Xs,Ys).
%% glutInitWindowSize(+X, +Y)
% set the initial window size.
glutInitWindowSize(Width,Height):-
W is Width,
H is Height,
c_glutInitWindowSize(W,H).
%% glutKeyboardFunc
% Sets the keyboard callback for the current window.
glutKeyboardFunc:-
c_glutKeyboardFunc.
%% glutMainLoop
% Enters the GLUT event processing loop.
glutMainLoop:-
c_glutMainLoop.
%% glutMotionFunc
% Set the motion and passive motion callbacks respectively
% for the current window.
glutMotionFunc:-
c_glutMotionFunc.
%% glutMouseFunc
% Sets the mouse callback for the current window.
glutMouseFunc:-
c_glutMouseFunc.
%% glutPostRedisplay
% Marks the current window as needing to be redisplayed.
glutPostRedisplay:-
c_glutPostRedisplay.
%% glutReshapeFunc
% Sets the reshape callback for the current window.
glutReshapeFunc:-
c_glutReshapeFunc.
%% glutReshapeWindow(+W, +H)
% Requests a change to the size of the current window.
glutReshapeWindow(W,H):-
c_glutReshapeWindow(W,H).
%% glutSetColor(+Index, +Red, +Green, +Blue)
% Sets the color of a colormap entry in the layer of use
% for the current window.
glutSetColor(Index, Red, Green, Blue) :-
float(Red),
float(Green),
float(Blue),
c_glutSetColor(Index, Red, Green, Blue).
%% glutSolidCone(+Radius, +Height, +Slices, +Stacks).
% Render a solid cone
glutSolidCone(Radius, Height, Slices, Stacks):-
float(Radius),
float(Height),
L is Slices,
T is Stacks,
c_glutSolidCone(Radius, Height, L, T).
%% glutSolidCube(+Size)
% Render a solid cube
glutSolidCube(Size) :-
float(Size),
c_glutSolidCube(Size).
%% glutSolidSphere(+Radius, +Slices, +Stacks)
% Render a solid sphere
glutSolidSphere(Radius, Slices, Stacks):-
float(Radius),
L is Slices,
T is Stacks,
c_glutSolidSphere(Radius, L, T).
%% glutSolidTeapot(+Size)
% Render a solid teapot
glutSolidTeapot(Size) :-
float(Size),
c_glutSolidTeapot(Size).
%% glutSolidTorus(+InnerRadius, +OuterRadius, +NSides, +Rings)
% Render a solid torus
glutSolidTorus(InnerRadius, OuterRadius, NSides, Rings):-
float(InnerRadius),
float(OuterRadius),
N is NSides,
R is Rings,
c_glutSolidTorus(InnerRadius, OuterRadius, N, R).
%% glutSwapBuffers
% Swaps the buffers of the current window if double buffered.
glutSwapBuffers:-
c_glutSwapBuffers.
%% glutWireCone(+Radius, +Height, +Slices, +Stacks).
% Render a wireframe cone
glutWireCone(Radius, Height, Slices, Stacks):-
float(Radius),
float(Height),
L is Slices,
T is Stacks,
c_glutWireCone(Radius, Height, L, T).
%% glutWireCube(+Size)
% Render a wireframe cube
glutWireCube(Size) :-
float(Size),
c_glutWireCube(Size).
%% glutWireSphere(+Radius, +Slices, +Stacks)
% Render a wireframe sphere
glutWireSphere(Radius, Slices, Stacks):-
float(Radius),
L is Slices,
T is Stacks,
c_glutWireSphere(Radius, L, T).
%% glutWireTeapot(+Size)
% Render a wireframe teapot
glutWireTeapot(Size) :-
float(Size),
c_glutWireTeapot(Size).
%% glutWireTorus(+InnerRadius, +OuterRadius, +NSides, +Rings)
% Render a wireframe torus
glutWireTorus(InnerRadius, OuterRadius, NSides, Rings):-
float(InnerRadius),
float(OuterRadius),
N is NSides,
R is Rings,
c_glutWireTorus(InnerRadius, OuterRadius, N, R).