source: Include/abgl.ab@ 104

Last change on this file since 104 was 102, checked in by NoWest, 18 years ago

バグを修正

File size: 48.2 KB
Line 
1#ifndef _INC_ABGL
2#define _INC_ABGL
3
4#include <GL/gl.sbp>
5#include <GL/glu.sbp>
6
7Class PositionOnly
8 x As GLfloat
9 y As GLfloat
10 z As GLfloat
11Public
12End Class
13
14Class PositionColoered
15 x As GLfloat
16 y As GLfloat
17 z As GLfloat
18 r As GLfloat
19 g As GLfloat
20 b As GLfloat
21 a As GLfloat
22Public
23End Class
24
25Type XY_FLOAT
26 x As GLfloat
27 y As GLfloat
28End Type
29
30Type XY_DOUBLE
31 x As GLdouble
32 y As GLdouble
33End Type
34
35Class Vector2f
36Public /* constructor */
37 Sub Vector2f()
38 This.X=0.0 As GLfloat
39 This.Y=0.0 As GLfloat
40 End Sub
41 Sub Vector2f(x As GLfloat, y As GLfloat)
42 This.X=x
43 This.Y=y
44 End Sub
45
46Public /* destructor */
47 Sub ~Vector2f()
48 End Sub
49
50Public /* property */
51 Function X() As GLfloat
52 Return xy.x
53 End Function
54 Function Y() As GLfloat
55 Return xy.y
56 End Function
57 Sub X(x As GLfloat)
58 xy.x=x
59 End Sub
60 Sub Y(y As GLfloat)
61 xy.y=y
62 End Sub
63
64Public /* operator */
65 Sub Operator = (ByRef SrcVec As Vector2f)
66 This.X=SrcVec.X
67 This.Y=SrcVec.Y
68 End Sub
69 Function Operator + (SrcVec As Vector2f) As Vector2f
70 Return Add(This,SrcVec)
71 End Function
72 Function Operator - (SrcVec As Vector2f) As Vector2f
73 Return Substract(This,SrcVec)
74 End Function
75/* Function Operator * (SrcVec As Vector2f) As Vector2f
76 Return Dot(This,SrcVec)
77 End Function
78*/
79 Function Operator * (Src As GLint) As Vector2f
80 Dim ret As Vector2f(This.X*Src,This.Y*Src)
81 Return ret
82 End Function
83 Function Operator * (Src As GLfloat) As Vector2f
84 Dim ret As Vector2f(This.X*Src,This.Y*Src)
85 Return ret
86 End Function
87 Function Operator * (Src As GLdouble) As Vector2f
88 Dim ret As Vector2f(This.X*Src As GLfloat,This.Y*Src As GLfloat)
89 Return ret
90 End Function
91 Function Operator / (Src As GLint) As Vector2f
92 Dim ret As Vector2f(This.X/Src,This.Y/Src)
93 Return ret
94 End Function
95 Function Operator / (Src As GLfloat) As Vector2f
96 Dim ret As Vector2f(This.X/Src,This.Y/Src)
97 Return ret
98 End Function
99 Function Operator / (Src As GLdouble) As Vector2f
100 Dim ret As Vector2f(This.X/Src,This.Y/Src)
101 Return ret
102 End Function
103
104
105Public /* method */
106 Static Function Add(SrcVec1 As Vector2f, SrcVec2 As Vector2f) As Vector2f
107 Dim ret As Vector2f(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y)
108 Return ret
109 End Function
110 Static Function Distance(SrcVec1 As Vector2f, SrcVec2 As Vector2f) As GLfloat
111 Dim ret As Vector2f
112 ret=SrcVec1-SrcVec2
113 Return ret.Magnitude
114 End Function
115 Static Function Dot(SrcVec1 As Vector2f, SrcVec2 As Vector2f) As GLfloat
116 Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y
117 End Function
118 Function Magnitude() As GLfloat
119 Return Math.Sqrt(This.X^2+This.Y^2) As GLfloat
120 End Function
121 Sub Normalize()
122 Dim ret As Vector2f(This.X/This.Magnitude,This.Y/This.Magnitude)
123 This = ret
124 End Sub
125 Function NormalizedVector() As Vector2f
126 Dim ret As Vector2f(This.X/This.Magnitude,This.Y/This.Magnitude)
127 Return ret
128 End Function
129 Static Function Substract(SrcVec1 As Vector2f, SrcVec2 As Vector2f) As Vector2f
130 Dim ret As Vector2f(SrcVec1.X-SrcVec2.X,SrcVec1.Y-SrcVec2.Y)
131 Return ret
132 End Function
133 Sub Reverse()
134 Dim ret As Vector2f(-This.X,-This.Y)
135 This = ret
136 End Sub
137 Function ReversedVector() As Vector2f
138 Dim ret As Vector2f(-This.X,-This.Y)
139 Return ret
140 End Function
141
142Protected
143 xy As XY_FLOAT
144End Class
145
146Class Vector2d
147Public /* constructor */
148 Sub Vector2d()
149 This.X=0.0 As GLdouble
150 This.Y=0.0 As GLdouble
151 End Sub
152 Sub Vector2d(x As GLdouble, y As GLdouble)
153 xy.x=x
154 xy.y=y
155 End Sub
156
157Public /* destructor */
158 Sub ~Vector2d()
159 End Sub
160
161Public /* property */
162 Function X() As GLdouble
163 Return xy.x
164 End Function
165 Function Y() As GLdouble
166 Return xy.y
167 End Function
168 Sub X(x As GLdouble)
169 xy.x=x
170 End Sub
171 Sub Y(y As GLdouble)
172 xy.y=y
173 End Sub
174
175Public /* operator */
176 Sub Operator = (ByRef SrcVec As Vector2d)
177 This.X=SrcVec.X
178 This.Y=SrcVec.Y
179 End Sub
180 Function Operator + (SrcVec As Vector2d) As Vector2d
181 Return Add(This,SrcVec2)
182 End Function
183 Function Operator - (SrcVec As Vector2d) As Vector2d
184 Return Substract(This,SrcVec2)
185 End Function
186/* Function Operator * (SrcVec As Vector2d) As Vector2d
187 Return Dot(This,SrcVec2)
188 End Function*/
189
190 Function Operator * (Src As GLint) As Vector2d
191 Dim ret As Vector2d(This.X*Src,SrcVec.Y*Src)
192 Return ret
193 End Function
194 Function Operator * (Src As GLfloat) As Vector2d
195 Dim ret As Vector2d(This.X*Src,SrcVec.Y*Src)
196 Return ret
197 End Function
198 Function Operator * (Src As GLdouble) As Vector2d
199 Dim ret As Vector2d(This.X*Src,SrcVec.Y*Src)
200 Return ret
201 End Function
202 Function Operator / (Src As GLint) As Vector2d
203 Dim ret As Vector2d(This.X/Src,SrcVec.Y/Src)
204 Return ret
205 End Function
206 Function Operator / (Src As GLfloat) As Vector2d
207 Dim ret As Vector2d(This.X/Src,SrcVec.Y/Src)
208 Return ret
209 End Function
210 Function Operator / (Src As GLdouble) As Vector2d
211 Dim ret As Vector2d(This.X/Src,SrcVec.Y/Src)
212 Return ret
213 End Function
214
215
216Public /* method */
217 Function Add(SrcVec1 As Vector2d, SrcVec2 As Vector2d) As Vector2d
218 Dim ret As Vector2d(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y)
219 Return ret
220 End Function
221 Function Distance(SrcVec1 As Vector2d, SrcVec2 As Vector2d) As GLdouble
222 Dim ret As Vector2d
223 ret=SrcVec1-SrcVec2
224 Return ret.Magnitude
225 End Function
226 Function Dot(SrcVec1 As Vector2d, SrcVec2 As Vector2d) As GLdouble
227 Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y
228 End Function
229 Function Magnitude() As GLdouble
230 Return Math.Sqrt(This.X^2+This.Y^2) As GLdouble
231 End Function
232 Sub Normalize()
233 Dim ret As Vector2d(This.X/This.Magnitude,This.Y/This.Magnitude)
234 This = ret
235 End Sub
236 Function NormalizedVector() As Vector2d
237 Dim ret As Vector2d(This.X/This.Magnitude,This.Y/This.Magnitude)
238 Return ret
239 End Function
240 Function Substract(SrcVec1 As Vector2d, SrcVec2 As Vector2d) As Vector2d
241 Dim ret As Vector2d(SrcVec1.X-SrcVec2.X,SrcVec1.Y-SrcVec2.Y)
242 Return ret
243 End Function
244 Sub Reverse()
245 Dim ret As Vector2d(-This.X,-This.Y)
246 This = ret
247 End Sub
248 Function ReversedVector() As Vector2d
249 Dim ret As Vector2d(-This.X,-This.Y)
250 Return ret
251 End Function
252
253Public
254 xz As XY_DOUBLE
255End Class
256
257
258Type XYZ_FLOAT
259 x As GLfloat
260 y As GLfloat
261 z As GLfloat
262End Type
263
264Type XYZ_DOUBLE
265 x As GLdouble
266 y As GLdouble
267 z As GLdouble
268End Type
269
270Class Vector3f
271Public /* constructor */
272 Sub Vector3f()
273 This.X=0.0 As GLfloat
274 This.Y=0.0 As GLfloat
275 This.Z=0.0 As GLfloat
276 End Sub
277 Sub Vector3f(x As GLfloat, y As GLfloat, z As GLfloat)
278 xyz.x=x
279 xyz.y=y
280 xyz.z=z
281 End Sub
282
283Public /* destructor */
284 Sub ~Vector3f()
285 End Sub
286
287Public /* property */
288 Function X() As GLfloat
289 Return xyz.x
290 End Function
291 Function Y() As GLfloat
292 Return xyz.y
293 End Function
294 Function Z() As GLfloat
295 Return xyz.z
296 End Function
297 Sub X(x As GLfloat)
298 xyz.x=x
299 End Sub
300 Sub Y(y As GLfloat)
301 xyz.y=y
302 End Sub
303 Sub Z(z As GLfloat)
304 xyz.z=z
305 End Sub
306
307Public /* operator */
308 Sub Operator = (ByRef SrcVec As Vector3f)
309 This.X=SrcVec.X
310 This.Y=SrcVec.Y
311 End Sub
312 Function Operator + (SrcVec As Vector3f) As Vector3f
313 Return Add(This,SrcVec)
314 End Function
315 Function Operator - (SrcVec As Vector3f) As Vector3f
316 Return Substract(This,SrcVec)
317 End Function
318/* Function Operator * (SrcVec As Vector3f) As Vector3f
319 Return Dot(This,SrcVec)
320 End Function*/
321 Function Operator ^ (SrcVec As Vector3f) As Vector3f
322 Return Cross(This,SrcVec)
323 End Function
324
325 Function Operator * (Src As GLint) As Vector3f
326 Dim ret As Vector3f(This.X*Src,This.Y*Src,This.Z*Src)
327 Return ret
328 End Function
329 Function Operator * (Src As GLfloat) As Vector3f
330 Dim ret As Vector3f(This.X*Src,This.Y*Src,This.Z*Src)
331 Return ret
332 End Function
333 Function Operator * (Src As GLdouble) As Vector3f
334 Dim ret As Vector3f(This.X*Src,This.Y*Src,This.Z*Src)
335 Return ret
336 End Function
337 Function Operator / (Src As GLint) As Vector3f
338 Dim ret As Vector3f(This.X/Src,This.Y/Src,This.Z/Src)
339 Return ret
340 End Function
341 Function Operator / (Src As GLfloat) As Vector3f
342 Dim ret As Vector3f(This.X/Src,This.Y/Src,This.Z/Src)
343 Return ret
344 End Function
345 Function Operator / (Src As GLdouble) As Vector3f
346 Dim ret As Vector3f(This.X/Src,This.Y/Src,This.Z/Src)
347 Return ret
348 End Function
349
350
351Public /* method */
352 Function Add(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As Vector3f
353 Dim ret As Vector3f(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z-SrcVec2.Z)
354 Return ret
355 End Function
356 Function Cross(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As Vector3f
357 Dim ret As Vector3f(SrcVec1.Y*SrcVec2.Z-SrcVec1.Z*SrcVec2.Y,SrcVec1.Z*SrcVec2.X-SrcVec1.X*SrcVec2.Z,SrcVec1.X*SrcVec2.Y-SrcVec1.Y*SrcVec2.X)
358 Return ret
359 End Function
360 Function Distance(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As GLfloat
361 Dim ret As Vector3f
362 ret=SrcVec1-SrcVec2
363 Return ret.Magnitude
364 End Function
365 Function Dot(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As GLfloat
366 Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y+SrcVec1.Z*SrcVec2.Z
367 End Function
368 Function Magnitude() As GLfloat
369 Return Math.Sqrt(This.X^2+This.Y^2+This.Z^2) As GLfloat
370 End Function
371 Sub Normalize()
372 Dim ret As Vector3f(This.X/This.Magnitude,This.Y/This.Magnitude,This.Z/This.Magnitude)
373 This = ret
374 End Sub
375 Function NormalizedVector() As Vector3f
376 Dim ret As Vector3f(This.X/This.Magnitude,This.Y/This.Magnitude,This.Z/This.Magnitude)
377 Return ret
378 End Function
379 Function Substract(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As Vector3f
380 Dim ret As Vector3f(SrcVec1.X-SrcVec2.X,SrcVec1.Y-SrcVec2.Y,SrcVec1.Z-SrcVec2.Z)
381 Return ret
382 End Function
383 Sub Reverse()
384 Dim ret As Vector3f(-This.X,-This.Y,-This.Z)
385 This = ret
386 End Sub
387 Function ReversedVector() As Vector3f
388 Dim ret As Vector3f(-This.X,-This.Y,-This.Z)
389 Return ret
390 End Function
391
392Public
393 xyz As XYZ_FLOAT
394End Class
395
396Class Vector3d
397Public /* constructor */
398 Sub Vector3d()
399 This.X=0.0 As GLdouble
400 This.Y=0.0 As GLdouble
401 This.Z=0.0 As GLdouble
402 End Sub
403 Sub Vector3d(x As GLdouble, y As GLdouble, z As GLdouble)
404 xyz.x=x
405 xyz.y=y
406 xyz.z=z
407 End Sub
408
409Public /* destructor */
410 Sub ~Vector3d()
411 End Sub
412
413
414Public /* property */
415 Function X() As GLdouble
416 Return xyz.x
417 End Function
418 Function Y() As GLdouble
419 Return xyz.y
420 End Function
421 Function Z() As GLdouble
422 Return xyz.z
423 End Function
424 Sub X(x As GLdouble)
425 xyz.x=x
426 End Sub
427 Sub Y(y As GLdouble)
428 xyz.y=y
429 End Sub
430 Sub Z(z As GLdouble)
431 xyz.z=z
432 End Sub
433
434
435Public /* operator */
436 Sub Operator = (ByRef SrcVec As Vector3d)
437 This.X=SrcVec.X
438 This.Y=SrcVec.Y
439 End Sub
440 Function Operator + (SrcVec As Vector3d) As Vector3d
441 Return Add(This,SrcVec)
442 End Function
443 Function Operator - (SrcVec As Vector3d) As Vector3d
444 Return Substract(This,SrcVec)
445 End Function
446/* Function Operator * (SrcVec As Vector3d) As Vector3d
447 Return Dot(This,SrcVec)
448 End Function*/
449 Function Operator ^ (SrcVec As Vector3d) As Vector3d
450 Return Cross(This,SrcVec)
451 End Function
452
453 Function Operator * (Src As GLint) As Vector3d
454 Dim ret As Vector3d(This.X*Src,This.Y*Src,This.Z*Src)
455 Return ret
456 End Function
457 Function Operator * (Src As GLfloat) As Vector3d
458 Dim ret As Vector3d(This.X*Src,This.Y*Src,This.Z*Src)
459 Return ret
460 End Function
461 Function Operator * (Src As GLdouble) As Vector3d
462 Dim ret As Vector3d(This.X*Src,This.Y*Src,This.Z*Src)
463 Return ret
464 End Function
465 Function Operator / (Src As GLint) As Vector3d
466 Dim ret As Vector3d(This.X/Src,This.Y/Src,This.Z/Src)
467 Return ret
468 End Function
469 Function Operator / (Src As GLfloat) As Vector3d
470 Dim ret As Vector3d(This.X/Src,This.Y/Src,This.Z/Src)
471 Return ret
472 End Function
473 Function Operator / (Src As GLdouble) As Vector3d
474 Dim ret As Vector3d(This.X/Src,This.Y/Src,This.Z/Src)
475 Return ret
476 End Function
477
478
479Public /* method */
480 Function Add(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As Vector3d
481 Dim ret As Vector3d(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z-SrcVec2.Z)
482 Return ret
483 End Function
484 Function Cross(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As Vector3d
485 Dim ret As Vector3d(SrcVec1.Y*SrcVec2.Z-SrcVec1.Z*SrcVec2.Y,SrcVec1.Z*SrcVec2.X-SrcVec1.X*SrcVec2.Z,SrcVec1.X*SrcVec2.Y-SrcVec1.Y*SrcVec2.X)
486 Return ret
487 End Function
488 Function Distance(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As GLdouble
489 Dim ret As Vector3d
490 ret=SrcVec1-SrcVec2
491 Return ret.Magnitude
492 End Function
493 Function Dot(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As GLdouble
494 Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y+SrcVec1.Z*SrcVec2.Z
495 End Function
496 Function Magnitude() As GLdouble
497 Return Math.Sqrt(This.X^2+This.Y^2+This.Z^2) As GLdouble
498 End Function
499 Sub Normalize()
500 Dim ret As Vector3d(This.X/This.Magnitude,This.Y/This.Magnitude,This.Z/This.Magnitude)
501 This = ret
502 End Sub
503 Function NormalizedVector() As Vector3d
504 Dim ret As Vector3d(This.X/This.Magnitude,This.Y/This.Magnitude,This.Z/This.Magnitude)
505 Return ret
506 End Function
507 Function Substract(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As Vector3d
508 Dim ret As Vector3d(SrcVec1.X-SrcVec2.X,SrcVec1.Y-SrcVec2.Y,SrcVec1.Z-SrcVec2.Z)
509 Return ret
510 End Function
511 Sub Reverse()
512 Dim ret As Vector3d(-This.X,-This.Y,-This.Z)
513 This = ret
514 End Sub
515 Function ReversedVector() As Vector3d
516 Dim ret As Vector3d(-This.X,-This.Y,-This.Z)
517 Return ret
518 End Function
519
520Public
521 xyz As XYZ_DOUBLE
522End Class
523
524
525Type RGB_FLOAT
526 r As GLfloat
527 g As GLfloat
528 b As GLfloat
529End Type
530
531Type RGB_DOUBLE
532 r As GLdouble
533 g As GLdouble
534 b As GLdouble
535End Type
536
537Class Color3f
538Public /* constructor */
539 Sub Color3f(r As GLfloat, g As GLfloat, b As GLfloat)
540 rgb.r = r
541 rgb.g = g
542 rgb.b = b
543 End Sub
544
545Public /* destructor */
546 Sub ~Color3f()
547 End Sub
548
549Public /* property */
550 Function R() As GLfloat
551 Return rgb.r
552 End Function
553 Function G() As GLfloat
554 Return rgb.g
555 End Function
556 Function B() As GLfloat
557 Return rgb.b
558 End Function
559 Sub R(r As GLfloat)
560 rgb.r = r
561 End Sub
562 Sub G(g As GLfloat)
563 rgb.g = g
564 End Sub
565 Sub B(b As GLfloat)
566 rgb.b = b
567 End Sub
568
569Public /* operator */
570 Sub operator = (c As Color3f)
571 This.R=c.R
572 This.G=c.G
573 This.B=c.B
574 End Sub
575
576Public /* method */
577 ' HSBを求める式はhttp://ofo.jp/osakana/cgtips/hsb.phtmlを参考にした
578 ' Drawwing\Color.abをさらに参考にしました。
579 Function GetHue() As GLfloat
580 Dim max As GLfloat, min As GLfloat, d As GLfloat
581 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
582 min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
583 d = max - min
584 If rgb.g = max Then
585 Return ((rgb.b - rgb.r) As Double / d * 60.0 + 120.0) As GLfloat
586 ElseIf rgb.b = max Then
587 Return ((rgb.r - rgb.g) As Double / d * 60.0 + 240.0) As GLfloat
588 ElseIf rgb.g < rgb.b Then
589 Return ((rgb.g - rgb.b) As Double / d * 60.0 + 360.0) As GLfloat
590 Else
591 Return ((rgb.g - rgb.b) As Double / d * 60.0) As GLfloat
592 EndIf
593 End Function
594
595 Function GetSaturation() As GLfloat
596 Dim max As GLfloat, min As GLfloat
597 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
598 min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
599 Return (max - min) / max
600 End Function
601
602 Function GetVolue() As GLfloat
603 Dim max As GLfloat
604 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
605 Return max
606 End Function
607
608Public /* static method */
609 Static Function FromRGB(r As GLubyte, g As GLubyte, b As GLubyte) As Color3f
610 Dim ret As Color3f((r As GLfloat)/255.0 As GLfloat,(g As GLfloat)/255.0 As GLfloat,(b As GLfloat)/255.0 As GLfloat)
611 Return ret
612 End Function
613 Static Function FromCOLORREF(c As COLORREF) As Color3f
614 Dim ret As Color3f((c and &hff) As GLfloat/255,(c>>8 and &hff) As GLfloat/255,(c>>16 and &hff) As GLfloat/255)
615 Return ret
616 End Function
617 Static Function FromHSV(h As GLfloat, s As GLfloat, v As GLfloat) As Color3f
618 Dim r As GLfloat
619 Dim g As GLfloat
620 Dim b As GLfloat
621 If h<0 Then h+=360.0
622 If h>360.0 Then h-=360.0
623 Select Case (h/60) As Long
624 Case 0
625 r=v
626 g=v*(1-s*(1-(h/60-(h/60) As Long)))
627 b=v*(1-s)
628 Case 1
629 r=v*(1-s*(h/60-(h/60) As Long))
630 g=v
631 b=v*(1-s)
632 Case 2
633 r=v*(1-s)
634 g=v
635 b=v*(1-s*(1-(h/60-(h/60) As Long)))
636 Case 3
637 r=v*(1-s)
638 g=v*(1-s*(h/60-(h/60) As Long))
639 b=v
640 Case 4
641 r=v*(1-s*(1-(h/60-(h/60) As Long)))
642 g=v*(1-s)
643 b=v
644 Case 5
645 r=v
646 g=v*(1-s)
647 b=v*(1-s*(h/60-(h/60) As Long))
648 Case 6
649 r=v
650 g=v*(1-s*(1-(h/60-(h/60) As Long)))
651 b=v*(1-s)
652 End Select
653
654 Dim ret As Color3f(r,g,b)
655 Return ret
656 End Function
657
658Public
659 rgb As RGB_FLOAT
660End Class
661
662Class Color3d
663Public /* constructor */
664 Sub Color3d(r As GLdouble, g As GLdouble, b As GLdouble)
665 rgb.r = r
666 rgb.g = g
667 rgb.b = b
668 End Sub
669
670Public /* destructor */
671 Sub ~Color3d()
672 End Sub
673
674Public /* property */
675 Function R() As GLdouble
676 Return rgb.r
677 End Function
678 Function G() As GLdouble
679 Return rgb.g
680 End Function
681 Function B() As GLdouble
682 Return rgb.b
683 End Function
684 Sub R(r As GLdouble)
685 rgb.r = r
686 End Sub
687 Sub G(g As GLdouble)
688 rgb.g = g
689 End Sub
690 Sub B(b As GLdouble)
691 rgb.b = b
692 End Sub
693
694Public /* method */
695 ' HSBを求める式はhttp://ofo.jp/osakana/cgtips/hsb.phtmlを参考にした
696 ' Drawwing\Color.abをさらに参考にしました。
697 Function GetHue() As GLdouble
698 Dim max As GLdouble, min As GLdouble, d As GLdouble
699 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
700 min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
701 d = max - min
702 If rgb.g = max Then
703 Return ((rgb.b - rgb.r) As Double / d * 60.0 + 120.0) As GLfloat
704 ElseIf rgb.b = max Then
705 Return ((rgb.r - rgb.g) As Double / d * 60.0 + 240.0) As GLfloat
706 ElseIf rgb.g < rgb.b Then
707 Return ((rgb.g - rgb.b) As Double / d * 60.0 + 360.0) As GLfloat
708 Else
709 Return ((rgb.g - rgb.b) As Double / d * 60.0) As GLfloat
710 EndIf
711 End Function
712
713 Function GetSaturation() As GLdouble
714 Dim max As GLdouble, min As GLdouble
715 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
716 min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
717 Return (max - min) / max
718 End Function
719
720 Function GetVolue() As GLdouble
721 Dim max As GLdouble
722 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
723 Return max
724 End Function
725
726Public /* static method */
727 Static Function FromRGB(r As GLubyte, g As GLubyte, b As GLubyte) As Color3d
728 Dim ret As Color3d(r/255,g/255,b/255)
729 Return ret
730 End Function
731 Static Function FromCOLORREF(c As COLORREF) As Color3d
732 Dim ret As Color3d((c and &hff)/255,(c>>8 and &hff)/255,(c>>16 and &hff)/255)
733 Return ret
734 End Function
735 Static Function FromHSV(h As GLdouble, s As GLdouble, v As GLdouble) As Color3f
736 Dim r As GLdouble
737 Dim g As GLdouble
738 Dim b As GLfloat
739 If h<0 Then h+=360.0
740 If h>360.0 Then h-=360.0
741 Select Case (h/60) As Long
742 Case 0
743 r=v
744 g=v*(1-s*(1-(h/60-(h/60) As Long)))
745 b=v*(1-s)
746 Case 1
747 r=v*(1-s*(h/60-(h/60) As Long))
748 g=v
749 b=v*(1-s)
750 Case 2
751 r=v*(1-s)
752 g=v
753 b=v*(1-s*(1-(h/60-(h/60) As Long)))
754 Case 3
755 r=v*(1-s)
756 g=v*(1-s*(h/60-(h/60) As Long))
757 b=v
758 Case 4
759 r=v*(1-s*(1-(h/60-(h/60) As Long)))
760 g=v*(1-s)
761 b=v
762 Case 5
763 r=v
764 g=v*(1-s)
765 b=v*(1-s*(h/60-(h/60) As Long))
766 Case 6
767 r=v
768 g=v*(1-s*(1-(h/60-(h/60) As Long)))
769 b=v*(1-s)
770 End Select
771
772 Dim ret As Color3d(r,g,b)
773 Return ret
774 End Function
775Public
776 rgb As RGB_DOUBLE
777End Class
778
779Type RGBA_FLOAT
780 r As GLfloat
781 g As GLfloat
782 b As GLfloat
783 a As GLfloat
784End Type
785
786Type RGBA_DOUBLE
787 r As GLdouble
788 g As GLdouble
789 b As GLdouble
790 a As GLdouble
791End Type
792
793Class Color4f
794Public /* constructor */
795 Sub Color4f(r As GLfloat, g As GLfloat, b As GLfloat, a As GLfloat)
796 rgba.r = r
797 rgba.g = g
798 rgba.b = b
799 rgba.a = a
800 End Sub
801
802Public /* destructor */
803 Sub ~Color4f()
804 End Sub
805
806Public /* property */
807 Function R() As GLfloat
808 Return rgba.r
809 End Function
810 Function G() As GLfloat
811 Return rgba.g
812 End Function
813 Function B() As GLfloat
814 Return rgba.b
815 End Function
816 Function A() As GLfloat
817 Return rgba.a
818 End Function
819 Sub R(r As GLfloat)
820 rgba.r = r
821 End Sub
822 Sub G(g As GLfloat)
823 rgba.g = g
824 End Sub
825 Sub B(b As GLfloat)
826 rgba.b = b
827 End Sub
828 Sub A(a As GLfloat)
829 rgba.a = a
830 End Sub
831
832Public /* operator */
833 Sub operator = (ByRef c As Color4f)
834 This.R=c.R
835 This.G=c.G
836 This.B=c.B
837 This.A=c.A
838 End Sub
839
840Public /* method */
841 ' HSBを求める式はhttp://ofo.jp/osakana/cgtips/hsb.phtmlを参考にした
842 ' Drawwing\Color.abをさらに参考にしました。
843 Function GetHue() As GLfloat
844 Dim max As GLfloat, min As GLfloat, d As GLfloat
845 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
846 min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
847 d = max - min
848 If rgb.g = max Then
849 Return ((rgb.b - rgb.r) As Double / d * 60.0 + 120.0) As GLfloat
850 ElseIf rgb.b = max Then
851 Return ((rgb.r - rgb.g) As Double / d * 60.0 + 240.0) As GLfloat
852 ElseIf rgb.g < rgb.b Then
853 Return ((rgb.g - rgb.b) As Double / d * 60.0 + 360.0) As GLfloat
854 Else
855 Return ((rgb.g - rgb.b) As Double / d * 60.0) As GLfloat
856 EndIf
857 End Function
858
859 Function GetSaturation() As GLfloat
860 Dim max As GLfloat, min As GLfloat
861 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
862 min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
863 Return (max - min) / max
864 End Function
865
866 Function GetVolue() As GLfloat
867 Dim max As GLfloat
868 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
869 Return max
870 End Function
871
872Public /* static method */
873 Static Function FromRGB(r As GLubyte, g As GLubyte, b As GLubyte) As Color4f
874 Dim ret As Color4f(r/255,g/255,b/255,1.0)
875 Return ret
876 End Function
877 Static Function FromARGB(a As GLubyte, r As GLubyte, g As GLubyte, b As GLubyte) As Color4f
878 Dim ret As Color4f(r/255,g/255,b/255,a/255)
879 Return ret
880 End Function
881 Static Function FromCOLORREF(c As COLORREF) As Color4f
882 Dim ret As Color4f((c and &hff)/255,(c>>8 and &hff)/255,(c>>16 and &hff)/255,1.0)
883 Return ret
884 End Function
885 Static Function FromHSV(h As GLfloat, s As GLfloat, v As GLfloat, a As GLfloat) As Color4f
886 Dim r As GLfloat
887 Dim g As GLfloat
888 Dim b As GLfloat
889 Dim a As GLfloat
890 If h<0 Then h+=360.0
891 If h>360.0 Then h-=360.0
892 Select Case (h/60) As Long
893 Case 0
894 r=v
895 g=v*(1-s*(1-(h/60-(h/60) As Long)))
896 b=v*(1-s)
897 Case 1
898 r=v*(1-s*(h/60-(h/60) As Long))
899 g=v
900 b=v*(1-s)
901 Case 2
902 r=v*(1-s)
903 g=v
904 b=v*(1-s*(1-(h/60-(h/60) As Long)))
905 Case 3
906 r=v*(1-s)
907 g=v*(1-s*(h/60-(h/60) As Long))
908 b=v
909 Case 4
910 r=v*(1-s*(1-(h/60-(h/60) As Long)))
911 g=v*(1-s)
912 b=v
913 Case 5
914 r=v
915 g=v*(1-s)
916 b=v*(1-s*(h/60-(h/60) As Long))
917 Case 6
918 r=v
919 g=v*(1-s*(1-(h/60-(h/60) As Long)))
920 b=v*(1-s)
921 End Select
922
923 Dim ret As Color4f(r,g,b,a)
924 Return ret
925 End Function
926
927Public
928 rgba As RGBA_FLOAT
929End Class
930
931Class Color4d
932
933Public /* constructor */
934 Sub Color4d(r As GLdouble, g As GLdouble, b As GLdouble, a As GLdouble)
935 rgba.r = r
936 rgba.g = g
937 rgba.b = b
938 rgba.a = a
939 End Sub
940
941Public /* destructor */
942 Sub ~Color4d()
943 End Sub
944
945Public /* property */
946 Function R() As GLdouble
947 Return rgba.r
948 End Function
949 Function G() As GLdouble
950 Return rgba.g
951 End Function
952 Function B() As GLdouble
953 Return rgba.b
954 End Function
955 Function A() As GLdouble
956 Return rgba.a
957 End Function
958 Sub R(r As GLdouble)
959 rgba.r = r
960 End Sub
961 Sub G(g As GLdouble)
962 rgba.g = g
963 End Sub
964 Sub B(b As GLdouble)
965 rgba.b = b
966 End Sub
967 Sub A(a As GLdouble)
968 rgba.a = a
969 End Sub
970
971Public /* operator */
972 Sub operator = (ByRef c As Color4d)
973 This.R=c.R
974 This.G=c.G
975 This.B=c.B
976 This.A=c.A
977 End Sub
978
979Public /* method */
980 ' HSBを求める式はhttp://ofo.jp/osakana/cgtips/hsb.phtmlを参考にした
981 ' Drawwing\Color.abをさらに参考にしました。
982 Function GetHue() As GLfloat
983 Dim max As GLfloat, min As GLfloat, d As GLfloat
984 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
985 min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
986 d = max - min
987 If rgb.g = max Then
988 Return ((rgb.b - rgb.r) As Double / d * 60.0 + 120.0) As GLdouble
989 ElseIf rgb.b = max Then
990 Return ((rgb.r - rgb.g) As Double / d * 60.0 + 240.0) As GLdouble
991 ElseIf rgb.g < rgb.b Then
992 Return ((rgb.g - rgb.b) As Double / d * 60.0 + 360.0) As GLdouble
993 Else
994 Return ((rgb.g - rgb.b) As Double / d * 60.0) As GLdouble
995 EndIf
996 End Function
997
998 Function GetSaturation() As GLdouble
999 Dim max As GLdouble, min As GLdouble
1000 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
1001 min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
1002 Return (max - min) / max
1003 End Function
1004
1005 Function GetVolue() As GLdouble
1006 Dim max As GLdouble
1007 max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
1008 Return max
1009 End Function
1010
1011Public /* static method */
1012 Static Function FromRGB(r As GLubyte, g As GLubyte, b As GLubyte) As Color4d
1013 Dim ret As Color4d(r/255,g/255,b/255,1.0)
1014 Return ret
1015 End Function
1016 Static Function FromARGB(a As GLubyte, r As GLubyte, g As GLubyte, b As GLubyte) As Color4d
1017 Dim ret As Color4d(r/255,g/255,b/255,a/255)
1018 Return ret
1019 End Function
1020 Static Function FromCOLORREF(c As COLORREF) As Color4d
1021 Dim ret As Color4d((c and &hff)/255,(c>>8 and &hff)/255,(c>>16 and &hff)/255,1.0)
1022 Return ret
1023 End Function
1024 Static Function FromHSV(h As GLdouble, s As GLdouble, v As GLdouble, a As GLdouble) As Color4d
1025 Dim r As GLdouble
1026 Dim g As GLdouble
1027 Dim b As GLdouble
1028 Dim a As GLdouble
1029 If h<0 Then h+=360.0
1030 If h>360.0 Then h-=360.0
1031 Select Case (h/60) As Long
1032 Case 0
1033 r=v
1034 g=v*(1-s*(1-(h/60-(h/60) As Long)))
1035 b=v*(1-s)
1036 Case 1
1037 r=v*(1-s*(h/60-(h/60) As Long))
1038 g=v
1039 b=v*(1-s)
1040 Case 2
1041 r=v*(1-s)
1042 g=v
1043 b=v*(1-s*(1-(h/60-(h/60) As Long)))
1044 Case 3
1045 r=v*(1-s)
1046 g=v*(1-s*(h/60-(h/60) As Long))
1047 b=v
1048 Case 4
1049 r=v*(1-s*(1-(h/60-(h/60) As Long)))
1050 g=v*(1-s)
1051 b=v
1052 Case 5
1053 r=v
1054 g=v*(1-s)
1055 b=v*(1-s*(h/60-(h/60) As Long))
1056 Case 6
1057 r=v
1058 g=v*(1-s*(1-(h/60-(h/60) As Long)))
1059 b=v*(1-s)
1060 End Select
1061
1062 Dim ret As Color4f(r,g,b,a)
1063 Return ret
1064 End Function
1065
1066Public
1067 rgba As RGBA_DOUBLE
1068End Class
1069
1070
1071Class Light
1072Private
1073 Const Number As GLenum
1074
1075Public
1076 Sub Enabled(enabled As GLboolean)
1077 If enabled Then
1078 glEnable(Number)
1079 Else
1080 glDisable(Number)
1081 End If
1082 End Sub
1083 Function Enabled() As GLboolean
1084 Dim lighting As GLboolean
1085 glGetBooleanv(Number,VarPtr(lighting))
1086 Return lighting
1087 End Function
1088
1089Public /* constructor */
1090 Sub Light(num As GLenum)
1091 Number=num
1092 End Sub
1093
1094Public
1095 Sub SetAmbient(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
1096 Dim amb[3] As GLfloat
1097 amb[0]=red
1098 amb[1]=green
1099 amb[2]=blue
1100 amb[3]=alpha
1101 glLightfv(Number,GL_AMBIENT,amb)
1102 End Sub
1103 Sub SetAmbient(ByRef color As Color4f)
1104 Dim amb[3] As GLfloat
1105 amb[0]=color.R
1106 amb[1]=color.G
1107 amb[2]=color.B
1108 amb[3]=color.A
1109 glLightfv(Number,GL_AMBIENT,amb)
1110 End Sub
1111 Sub SetAmbient(amb As *GLfloat)
1112 glLightfv(Number,GL_AMBIENT,amb)
1113 End Sub
1114
1115 Sub SetDiffuse(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
1116 Dim dif[3] As GLfloat
1117 dif[0]=red
1118 dif[1]=green
1119 dif[2]=blue
1120 dif[3]=alpha
1121 glLightfv(Number,GL_DIFFUSE,dif)
1122 End Sub
1123 Sub SetDiffuse(ByRef color As Color4f)
1124 Dim dif[3] As GLfloat
1125 amb[0]=color.R
1126 amb[1]=color.G
1127 amb[2]=color.B
1128 amb[3]=color.A
1129 glLightfv(Number,GL_DIFFUSE,dif)
1130 End Sub
1131 Sub SetDiffuse(dif As *GLfloat)
1132 glLightfv(Number,GL_DIFFUSE,dif)
1133 End Sub
1134
1135 Sub SetSpecular(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
1136 Dim spc[3] As GLfloat
1137 spc[0]=red
1138 spc[1]=green
1139 spc[2]=blue
1140 spc[3]=alpha
1141 glLightfv(Number,GL_SPECULAR,spc)
1142 End Sub
1143 Sub SetSpecular(ByRef color As Color4f)
1144 Dim spc[3] As GLfloat
1145 amb[0]=color.R
1146 amb[1]=color.G
1147 amb[2]=color.B
1148 amb[3]=color.A
1149 glLightfv(Number,GL_SPECULAR,spc)
1150 End Sub
1151 Sub SetSpecular(spc As *GLfloat)
1152 glLightfv(Number,GL_SPECULAR,spc)
1153 End Sub
1154
1155 Sub SetPosition(pos As *GLfloat)
1156 glLightfv(Number,GL_POSITION,pos)
1157 End Sub
1158End Class
1159
1160Class Material
1161Public
1162 Sub Ambient(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
1163 Dim face As GLenum
1164 glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
1165 Dim amb[3] As GLfloat
1166 amb[0]=red
1167 amb[1]=green
1168 amb[2]=blue
1169 amb[3]=alpha
1170 glMaterialfv(face,GL_AMBIENT,amb)
1171 End Sub
1172 Sub Ambient(ByRef color As Color4f)
1173 Dim face As GLenum
1174 glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
1175 Dim amb[3] As GLfloat
1176 amb[0]=color.R
1177 amb[1]=color.G
1178 amb[2]=color.B
1179 amb[3]=color.A
1180 glMaterialfv(face,GL_AMBIENT,amb)
1181 End Sub
1182 Sub Ambient(amb As *GLfloat)
1183 glMaterialfv(face,GL_AMBIENT,amb)
1184 End Sub
1185
1186 Sub Diffuse(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
1187 Dim face As GLenum
1188 glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
1189 Dim dif[3] As GLfloat
1190 dif[0]=red
1191 dif[1]=green
1192 dif[2]=blue
1193 dif[3]=alpha
1194 glMaterialfv(face,GL_DIFFUSE,dif)
1195 End Sub
1196 Sub Diffuse(ByRef color As Color4f)
1197 Dim face As GLenum
1198 glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
1199 Dim dif[3] As GLfloat
1200 dif[0]=color.R
1201 dif[1]=color.G
1202 dif[2]=color.B
1203 dif[3]=color.A
1204 glMaterialfv(face,GL_DIFFUSE,dif)
1205 End Sub
1206 Sub Diffuse(dif As *GLfloat)
1207 glMaterialfv(face,GL_DIFFUSE,dif)
1208 End Sub
1209
1210 Sub Specular(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
1211 Dim face As GLenum
1212 glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
1213 Dim spc[3] As GLfloat
1214 spc[0]=red
1215 spc[1]=green
1216 spc[2]=blue
1217 spc[3]=alpha
1218 glMaterialfv(face,GL_SPECULAR,spc)
1219 End Sub
1220 Sub Specular(ByRef color As Color4f)
1221 Dim face As GLenum
1222 glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
1223 Dim spc[3] As GLfloat
1224 spc[0]=color.R
1225 spc[1]=color.G
1226 spc[2]=color.B
1227 spc[3]=color.A
1228 glMaterialfv(face,GL_SPECULAR,spc)
1229 End Sub
1230 Sub Specular(spc As *GLfloat)
1231 glMaterialfv(face,GL_SPECULAR,spc)
1232 End Sub
1233
1234 Sub Shininess(shin As GLfloat)
1235 Dim face As GLenum
1236 glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
1237 glMaterialf(face,GL_SHININESS,shin)
1238 End Sub
1239
1240 Sub Emission(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
1241 Dim face As GLenum
1242 glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
1243 Dim ems[3] As GLfloat
1244 ems[0]=red
1245 ems[1]=green
1246 ems[2]=blue
1247 ems[3]=alpha
1248 glMaterialfv(face,GL_EMISSION,ems)
1249 End Sub
1250End Class
1251
1252Class ModelView
1253Public
1254 Sub LoadIdentity()
1255 Dim mode As GLenum
1256 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
1257 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1258 glLoadIdentity()
1259 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1260 End Sub
1261 Sub LookAt(eyex As GLdouble, eyey As GLdouble, eyez As GLdouble, centerx As GLdouble, centery As GLdouble, centerz As GLdouble, upx As GLdouble, upy As GLdouble, upz As GLdouble)
1262 Dim mode As GLenum
1263 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1264 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1265 gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz)
1266 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1267 End Sub
1268 Sub RotateX(angle As GLdouble)
1269 Dim mode As GLenum
1270 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
1271 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1272 glRotated(angle, 1.0 As GLdouble, 0.0 As GLdouble, 0.0 As GLdouble)
1273 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1274 End Sub
1275 Sub RotateX(angle As GLfloat)
1276 Dim mode As GLenum
1277 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1278 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1279 glRotatef(angle, 1.0 As GLfloat, 0.0 As GLfloat, 0.0 As GLfloat)
1280 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1281 End Sub
1282 Sub RotateY(angle As GLdouble)
1283 Dim mode As GLenum
1284 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
1285 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1286 glRotated(angle, 0.0 As GLdouble, 1.0 As GLdouble, 0.0 As GLdouble)
1287 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1288 End Sub
1289 Sub RotateY(angle As GLfloat)
1290 Dim mode As GLenum
1291 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1292 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1293 glRotatef(angle, 0.0 As GLfloat, 1.0 As GLfloat, 0.0 As GLfloat)
1294 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1295 End Sub
1296 Sub RotateZ(angle As GLdouble)
1297 Dim mode As GLenum
1298 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1299 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1300 glRotated(angle, 0.0 As GLdouble, 0.0 As GLdouble, 1.0 As GLdouble)
1301 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1302 End Sub
1303 Sub RotateZ(angle As GLfloat)
1304 Dim mode As GLenum
1305 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1306 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1307 glRotatef(angle, 0.0 As GLfloat, 0.0 As GLfloat, 1.0 As GLfloat)
1308 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1309 End Sub
1310 Sub Scale(x As GLdouble, y As GLdouble, z As GLdouble)
1311 Dim mode As GLenum
1312 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1313 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1314 glScaled(x, y, z)
1315 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1316 End Sub
1317 Sub Scale(x As GLfloat, y As GLfloat, z As GLfloat)
1318 Dim mode As GLenum
1319 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1320 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1321 glScalef(x, y, z)
1322 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1323 End Sub
1324 Sub Translate(x As GLdouble, y As GLdouble, z As GLdouble)
1325 Dim mode As GLenum
1326 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1327 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1328 glTranslated(x, y, z)
1329 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1330 End Sub
1331 Sub Translate(x As GLfloat, y As GLfloat, z As GLfloat)
1332 Dim mode As GLenum
1333 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
1334 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
1335 glTranslatef(x, y, z)
1336 If mode<>GL_MODELVIEW Then glMatrixMode(mode)
1337 End Sub
1338End Class
1339
1340Class Projection
1341Public
1342 Sub LoadIdentity()
1343 Dim mode As GLenum
1344 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
1345 If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
1346 glLoadIdentity()
1347 If mode<>GL_PROJECTION Then glMatrixMode(mode)
1348 End Sub
1349 Sub Ortho2D(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble)
1350 Dim mode As GLenum
1351 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1352 If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
1353 gluOrtho2D(left, right, bottom, top)
1354 If mode<>GL_PROJECTION Then glMatrixMode(mode)
1355 End Sub
1356 Sub Ortho3D(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble, zNear As GLdouble, zFar As GLdouble)
1357 Dim mode As GLenum
1358 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1359 If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
1360 glOrtho(left, right, bottom, top, zNear, zFar)
1361 If mode<>GL_PROJECTION Then glMatrixMode(mode)
1362 End Sub
1363 Sub Frustum(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble, zNear As GLdouble, zFar As GLdouble)
1364 Dim mode As GLenum
1365 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
1366 If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
1367 glFrustum(left, right, bottom, top, zNear, zFar)
1368 If mode<>GL_PROJECTION Then glMatrixMode(mode)
1369 End Sub
1370 Sub Perspective(fovy As GLdouble, aspect As GLdouble, zNear As GLdouble, zFar As GLdouble)
1371 Dim mode As GLenum
1372 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
1373 If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
1374 gluPerspective(fovy, aspect, zNear, zFar)
1375 If mode<>GL_PROJECTION Then glMatrixMode(mode)
1376 End Sub
1377End Class
1378
1379Class Transform
1380Public
1381 Projection As Projection
1382 ModelView As ModelView
1383End Class
1384
1385Class LightModel
1386Public
1387 Function Ambient () As Color4f
1388 Dim amb As Color4f
1389 glGetFloatv(GL_LIGHT_MODEL_AMBIENT,VarPtr(amb.rgba))
1390 Return amb
1391 End Function
1392 Sub Ambient(amb As Color4f)
1393 glLightModelfv(GL_LIGHT_MODEL_AMBIENT,VarPtr(amb.rgba))
1394 End Sub
1395
1396 Function LocalView() As GLboolean
1397 Dim local As GLboolean
1398 glGetBooleanv(GL_LIGHT_MODEL_LOCAL_VIEW,VarPtr(local))
1399 Return local
1400 End Function
1401 Sub LocalView(enable As GLboolean)
1402 If enable Then
1403 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEW,GL_TRUE)
1404 Else
1405 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEW,GL_FALSE)
1406 End If
1407 End Sub
1408
1409 Function TwoSide() As GLboolean
1410 Dim local As GLboolean
1411 glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE,VarPtr(local))
1412 Return local
1413 End Function
1414 Sub TwoSide(enable As GLboolean)
1415 If enable Then
1416 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE)
1417 Else
1418 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_FALSE)
1419 End If
1420 End Sub
1421End Class
1422
1423Class RenderStateManager
1424Public /* Composiotion */
1425 LightModel As LightModel
1426
1427Public
1428 Function AlphaTestEnable() As GLboolean
1429 Dim alpha As GLboolean
1430 glGetBooleanv(GL_ALPHA_TEST,VarPtr(alpha))
1431 Return alpha
1432 End Function
1433 Sub AlphaTestEnable(enable As GLboolean)
1434 If enable Then
1435 glEnable(GL_ALPHA_TEST)
1436 Else
1437 glDisable(GL_ALPHA_TEST)
1438 End If
1439 End Sub
1440
1441 Function AlphaFunction() As GLenum
1442 Dim func As GLenum
1443 glGetIntegerv(GL_ALPHA_TEST_FUNC,VarPtr(func))
1444 Return func
1445 End Function
1446 Sub AlphaFunction(func As GLenum)
1447 Dim ref As GLclampf
1448 glGetFloatv(GL_ALPHA_TEST_REF,VarPtr(ref))
1449 glAlphaFunc(func,ref)
1450 End Sub
1451
1452 Function BlendEnable() As GLboolean
1453 Dim blend As GLboolean
1454 glGetBooleanv(GL_BLEND,VarPtr(blend))
1455 Return blend
1456 End Function
1457 Sub BlendEnable(enable As GLboolean)
1458 If enable Then
1459 glEnable(GL_BLEND)
1460 Else
1461 glDisable(GL_BLEND)
1462 End If
1463 End Sub
1464
1465 Function BlendDestinationFactor() As GLenum
1466 Dim dfactor As GLenum
1467 glGetIntegerv(GL_BLEND_DST,VarPtr(dfactor))
1468 Return dfactor
1469 End Function
1470 Sub BlendDestinationFactor(dfactor As GLenum)
1471 Dim sfactor As GLenum
1472 glGetIntegerv(GL_BLEND_SRC,VarPtr(sfactor))
1473 glBlendFunc(sfactor,dfactor)
1474 End Sub
1475
1476 Function BlendSourceFactor() As GLenum
1477 Dim sfactor As GLenum
1478 glGetIntegerv(GL_BLEND_SRC,VarPtr(sfactor))
1479 Return sfactor
1480 End Function
1481 Sub BlendSourceFactor(sfactor As GLenum)
1482 Dim dfactor As GLenum
1483 glGetIntegerv(GL_BLEND_DST,VarPtr(dfactor))
1484 glBlendFunc(sfactor,dfactor)
1485 End Sub
1486
1487 Function CullFaceEnable() As GLboolean
1488 Dim cull As GLboolean
1489 glGetBooleanv(GL_CULL_FACE,VarPtr(cull))
1490 Return cull
1491 End Function
1492 Sub CullFaceEnable(enable As GLboolean)
1493 If enable Then
1494 glEnable(GL_CULL_FACE)
1495 Else
1496 glDisable(GL_CULL_FACE)
1497 End If
1498 End Sub
1499
1500 Function CullFaceMode () As GLenum
1501 Dim mode As GLenum
1502 glGetIntegerv(GL_CULL_FACE_MODE,VarPtr(mode))
1503 Return mode
1504 End Function
1505 Sub CullFaceMode(mode As GLenum)
1506 glCullFace(mode)
1507 End Sub
1508
1509 Function DepthTestEnable () As GLboolean
1510 Dim depth As GLboolean
1511 glGetBooleanv(GL_DEPTH_TEST,VarPtr(depth))
1512 Return depth
1513 End Function
1514 Sub DepthTestEnable(enable As GLboolean)
1515 If enable Then
1516 glEnable(GL_DEPTH_TEST)
1517 Else
1518 glDisable(GL_DEPTH_TEST)
1519 End If
1520 End Sub
1521
1522 Function DepthFunction () As GLenum
1523 Dim func As GLenum
1524 glGetIntegerv(GL_DEPTH_FUNC,VarPtr(func))
1525 Return func
1526 End Function
1527 Sub DepthFunction(func As GLenum)
1528 glDepthFunc(func)
1529 End Sub
1530
1531 Function DepthBufferWritable() As GLboolean
1532 Dim writable As GLboolean
1533 glGetBooleanv(GL_DEPTH_WRITEMASK,VarPtr(writable))
1534 Return writable
1535 End Function
1536 Sub DepthBufferWritable(enable As GLboolean)
1537 If enable Then
1538 glDepthMask(GL_DEPTH_WRITEMASK)
1539 Else
1540 glDepthMask(GL_DEPTH_WRITEMASK)
1541 End If
1542 End Sub
1543
1544 Function DitherEnable() As GLboolean
1545 Dim dither As GLboolean
1546 glGetBooleanv(GL_DITHER,VarPtr(dither))
1547 Return dither
1548 End Function
1549 Sub DitherEnable(enable As GLboolean)
1550 If enable Then
1551 glEnable(GL_DITHER)
1552 Else
1553 glDisable(GL_DITHER)
1554 End If
1555 End Sub
1556
1557 Function FogEnable () As GLboolean
1558 Dim fog As GLboolean
1559 glGetBooleanv(GL_FOG,VarPtr(fog))
1560 Return fog
1561 End Function
1562 Sub FogEnable(enable As GLboolean)
1563 If enable Then
1564 glEnable(GL_FOG)
1565 Else
1566 glDisable(GL_FOG)
1567 End If
1568 End Sub
1569
1570 Function FogMode() As GLenum
1571 Dim mode As GLenum
1572 glGetIntegerv(GL_FOG_MODE,VarPtr(mode))
1573 Return mode
1574 End Function
1575 Sub FogMode(mode As GLenum)
1576 glFogi(GL_FOG_MODE,mode)
1577 End Sub
1578
1579 Function FogColor() As Color4f
1580 Dim ret As Color4f
1581 glGetFloatv(GL_FOG_COLOR,VarPtr(ret.rgba))
1582 Return ret
1583 End Function
1584 Sub FogColor(fcolor As Color4f)
1585 glFogfv(GL_FOG_COLOR,VarPtr(fcolor.rgba))
1586 End Sub
1587
1588 Function FogDensity() As GLfloat
1589 Dim density As GLfloat
1590 glGetFloatv(GL_FOG_DENSITY,density)
1591 Return density
1592 End Function
1593 Sub FogDensity(density As GLfloat)
1594 glFogf(GL_FOG_DENSITY,density)
1595 End Sub
1596
1597 Function FogStart() As GLfloat
1598 Dim fstrat As GLfloat
1599 glGetFloatv(GL_FOG_START,fstrat)
1600 Return fstrat
1601 End Function
1602 Sub FogStart(fstrat As GLfloat)
1603 glFogf(GL_FOG_START,fstrat)
1604 End Sub
1605
1606 Function FogEnd() As GLfloat
1607 Dim fend As GLfloat
1608 glGetFloatv(GL_FOG_END,fend)
1609 Return fend
1610 End Function
1611 Sub FogEnd(fend As GLfloat)
1612 glFogf(GL_FOG_END,fend)
1613 End Sub
1614
1615 Function Lighting() As GLboolean
1616 Dim lighting As GLboolean
1617 glGetBooleanv(GL_LIGHTING,VarPtr(lighting))
1618 Return lighting
1619 End Function
1620 Sub Lighting(enable As GLboolean)
1621 If enable Then
1622 glEnable(GL_LIGHTING)
1623 Else
1624 glDisable(GL_LIGHTING)
1625 End If
1626 End Sub
1627
1628 Function LineSmoothEnable() As GLboolean
1629 Dim smooth As GLboolean
1630 glGetBooleanv(GL_LINE_SMOOTH,VarPtr(smooth))
1631 Return smooth
1632 End Function
1633 Sub LineSmoothEnable(enable As GLboolean)
1634 If enable Then
1635 glEnable(GL_LINE_SMOOTH)
1636 Else
1637 glDisable(GL_LINE_SMOOTH)
1638 End If
1639 End Sub
1640
1641 Function LogicOpEnable() As GLboolean
1642 Dim logic As GLboolean
1643 glGetBooleanv(GL_COLOR_LOGIC_OP,VarPtr(logic))
1644 Return logic
1645 End Function
1646 Sub LogicOpEnable(enable As GLboolean)
1647 If enable Then
1648 glEnable(GL_COLOR_LOGIC_OP)
1649 Else
1650 glDisable(GL_COLOR_LOGIC_OP)
1651 End If
1652 End Sub
1653
1654 Function LogicOpCode() As GLenum
1655 Dim code As GLenum
1656 glGetFloatv(GL_COLOR_LOGIC_OP_MODE,code)
1657 Return code
1658 End Function
1659 Sub LogicOpCode(code As GLenum)
1660 glLogicOp(code)
1661 End Sub
1662
1663 Function PointSmoothEnable() As GLboolean
1664 Dim smooth As GLboolean
1665 glGetBooleanv(GL_POINT_SMOOTH,VarPtr(smooth))
1666 Return smooth
1667 End Function
1668 Sub PointSmoothEnable(enable As GLboolean)
1669 If enable Then
1670 glEnable(GL_POINT_SMOOTH)
1671 Else
1672 glDisable(GL_POINT_SMOOTH)
1673 End If
1674 End Sub
1675
1676 Function PolygonSmoothEnable() As GLboolean
1677 Dim smooth As GLboolean
1678 glGetBooleanv(GL_POLYGON_SMOOTH,VarPtr(smooth))
1679 Return smooth
1680 End Function
1681 Sub PolygonSmoothEnable(enable As GLboolean)
1682 If enable Then
1683 glEnable(GL_POLYGON_SMOOTH)
1684 Else
1685 glDisable(GL_POLYGON_SMOOTH)
1686 End If
1687 End Sub
1688
1689 Function ReferenceAlpha() As GLclampf
1690 Dim ref As GLclampf
1691 glGetFloatv(GL_ALPHA_TEST_REF,VarPtr(ref))
1692 Return ref
1693 End Function
1694 Sub ReferenceAlpha(ref As GLclampf)
1695 Dim func As GLenum
1696 glGetIntegerv(GL_ALPHA_TEST_FUNC,VarPtr(func))
1697 glAlphaFunc(func,ref)
1698 End Sub
1699
1700 Function ShadeModel() As GLenum
1701 Dim mode As GLenum
1702 glGetIntegerv(GL_SHADE_MODEL,VarPtr(mode))
1703 Return mode
1704 End Function
1705 Sub ShadeModel(mode As GLenum)
1706 glShadeModel(mode)
1707 End Sub
1708End Class
1709
1710
1711Enum ColorType
1712 RgbColor=0
1713 RgbaColor=0
1714 IndexColor
1715End Enum
1716
1717Enum BufferType
1718 SingleBuffer=0
1719 DoubleBuffer
1720End Enum
1721
1722Enum ClearBuffer
1723 DepthBufferBit = &H00000100
1724 AccumBufferBit = &H00000200
1725 StencilBufferBit = &H00000400
1726 ColorBufferBit = &H00004000
1727End Enum
1728
1729Enum PrimitiveMode
1730 Points = &H0000
1731 Lines = &H0001
1732 LineLoop = &H0002
1733 LineStrip = &H0003
1734 Triangles = &H0004
1735 TriangleStrip = &H0005
1736 TriangleFan = &H0006
1737 Quads = &H0007
1738 QuadStrip = &H0008
1739 Polygon = &H0009
1740End Enum
1741
1742Class RenderingContext
1743Public /* Composiotion */
1744 Material As Material
1745 RenderState As RenderStateManager
1746 Transform As Transform
1747 Lights[ELM(8)] As Light
1748
1749Public /* Constructor */
1750 Sub RenderingContext()
1751 Dim hrc As HGLRC
1752 hrc=wglGetCurrentContext()
1753 If hrc Then
1754 wglMakeCurrent(NULL,NULL)
1755 wglDeleteContext(hrc)
1756 End If
1757
1758 Lights[0].Light(GL_LIGHT0)
1759 Lights[1].Light(GL_LIGHT1)
1760 Lights[2].Light(GL_LIGHT2)
1761 Lights[3].Light(GL_LIGHT3)
1762 Lights[4].Light(GL_LIGHT4)
1763 Lights[5].Light(GL_LIGHT5)
1764 Lights[6].Light(GL_LIGHT6)
1765 Lights[7].Light(GL_LIGHT7)
1766 End Sub
1767 Sub RenderingContext(hdc As HDC, ByRef pfd As PIXELFORMATDESCRIPTOR)
1768 RenderingContext()
1769
1770 Dim pf As Long
1771 pf=ChoosePixelFormat(hdc,pfd)
1772 If pf=0 Then
1773 MessageBox(NULL,"Choose Pixel Format failed","error",MB_OK)
1774 Exit Sub
1775 End If
1776 If SetPixelFormat(hdc,pf,pfd)=FALSE Then
1777 MessageBox(NULL,"Set Pixel Format failed","error",MB_OK)
1778 Exit Sub
1779 End If
1780
1781 Dim hrc As HGLRC
1782 hrc=wglCreateContext(hdc)
1783 wglMakeCurrent(hdc,hrc)
1784 End Sub
1785 Sub RenderingContext(hdc As HDC, ByRef ctype As ColorType, ByRef btype As BufferType)
1786 RenderingContext()
1787
1788 Dim pfd As PIXELFORMATDESCRIPTOR
1789 pfd.nSize=SizeOf(PIXELFORMATDESCRIPTOR) As Word
1790 pfd.nVersion=GL_VERSION_1_1
1791 If btype=BufferType.DoubleBuffer As Long Then
1792 pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER
1793 Else
1794 pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL
1795 End If
1796 If ctype=ColorType.RgbColor As Long Then
1797 pfd.iPixelType=PFD_TYPE_RGBA
1798 Else
1799 pfd.iPixelType=PFD_TYPE_COLORINDEX
1800 End If
1801 pfd.cColorBits=24
1802 pfd.cRedBits=0
1803 pfd.cRedShift=0
1804 pfd.cGreenBits=0
1805 pfd.cGreenShift=0
1806 pfd.cBlueBits=0
1807 pfd.cBlueShift=0
1808 pfd.cAlphaBits=0
1809 pfd.cAlphaShift=0
1810 pfd.cAccumBits=0
1811 pfd.cAccumRedBits=0
1812 pfd.cAccumGreenBits=0
1813 pfd.cAccumBlueBits=0
1814 pfd.cAccumAlphaBits=0
1815 pfd.cDepthBits=32
1816 pfd.cStencilBits=0
1817 pfd.cAuxBuffers=0
1818 pfd.iLayerType=PFD_MAIN_PLANE
1819 pfd.bReserved=0
1820 pfd.dwLayerMask=0
1821 pfd.dwVisibleMask=0
1822 pfd.dwDamageMask=0
1823 RenderingContext(hdc,pfd)
1824 End Sub
1825 Sub RenderingContext(hdc As HDC)
1826 RenderingContext(hdc As HDC, ColorType.RgbColor, BufferType.DoubleBuffer)
1827 End Sub
1828
1829Public /* Destructor */
1830 Sub ~RenderingContext()
1831 Dim hrc As HGLRC
1832 hrc=wglGetCurrentContext()
1833 wglMakeCurrent(NULL,NULL)
1834 wglDeleteContext(hrc)
1835 End Sub
1836
1837Public /* Method */
1838 Sub Begin(mode As GLenum)
1839 glBegin(mode)
1840 End Sub
1841 Sub Begin(mode As PrimitiveMode)
1842 glBegin(mode)
1843 End Sub
1844 Sub Clear(mask As GLbitfield)
1845 glClear(mask)
1846 End Sub
1847 Sub Clear(mask As ClearBuffer)
1848 glClear(mask)
1849 End Sub
1850
1851 Sub ClearAccum(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
1852 glClearAccum(red, green, blue, alpha)
1853 End Sub
1854 Sub ClearAccum(color As Color4f)
1855 glClearAccum(color.R, color.G, color.B, color.A)
1856 End Sub
1857 Sub ClearColor(red As GLclampf, green As GLclampf, blue As GLclampf, alpha As GLclampf)
1858 glClearColor(red, green, blue, alpha)
1859 End Sub
1860 Sub ClearColor(color As Color4f)
1861 glClearColor(color.R, color.G, color.B, color.A)
1862 End Sub
1863 Sub ClearDepth(depth As GLclampd)
1864 glClearDepth(depth)
1865 End Sub
1866 Sub ClearIndex(c As GLfloat)
1867 glClearIndex(c)
1868 End Sub
1869 Sub ClearStencil(s As GLint)
1870 glClearStencil(s)
1871 End Sub
1872
1873 Sub Color(red As GLdouble, green As GLdouble, blue As GLdouble)
1874 glColor3d(red,green,blue)
1875 End Sub
1876 Sub Color(red As GLdouble, green As GLdouble, blue As GLdouble, alpha As GLdouble)
1877 glColor4d(red,green,blue,alpha)
1878 End Sub
1879 Sub Color(red As GLfloat, green As GLfloat, blue As GLfloat)
1880 glColor3f(red,green,blue)
1881 End Sub
1882 Sub Color(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
1883 glColor4f(red,green,blue,alpha)
1884 End Sub
1885 Sub Color(c As Color3f)
1886 glColor3fv(VarPtr(c.rgb) As *Single)
1887 End Sub
1888 Sub Color(c As Color4f)
1889 glColor4fv(VarPtr(c.rgba) As *Single)
1890 End Sub
1891 Sub Color(c As Color3d)
1892 glColor3dv(VarPtr(c.rgb) As *Double)
1893 End Sub
1894 Sub Color(c As Color4d)
1895 glColor4dv(VarPtr(c.rgba) As *Double)
1896 End Sub
1897
1898 Sub DrawPrimiteve()
1899 End Sub
1900
1901 Sub End()
1902 glEnd()
1903 End Sub
1904
1905 Sub Finish()
1906 glFinish()
1907 End Sub
1908 Sub Flush()
1909 glFlush()
1910 End Sub
1911
1912 Function GenerateTexures() As GLint
1913 glGenTextures()
1914 End Function
1915
1916 Sub MatrixMode(mode As GLenum)
1917 glMatrixMode(mode)
1918 End Sub
1919
1920 Sub Present()
1921 SwapBuffers(wglGetCurrentDC())
1922 End Sub
1923 Sub Present(hdc As HDC)
1924 SwapBuffers(hdc)
1925 End Sub
1926
1927 Sub PopMatrix()
1928 glPopMatrix()
1929 End Sub
1930
1931 Sub PushMatrix()
1932 glPushMatrix()
1933 End Sub
1934
1935 Sub Vertex(x As GLdouble, y As GLdouble)
1936 glVertex2d(x,y)
1937 End Sub
1938 Sub Vertex(x As GLdouble, y As GLdouble, z As GLdouble)
1939 glVertex3d(x,y,z)
1940 End Sub
1941 Sub Vertex(x As GLdouble, y As GLdouble, z As GLdouble, w As GLdouble)
1942 glVertex4d(x,y,z,w)
1943 End Sub
1944 Sub Vertex(x As GLfloat, y As GLfloat)
1945 glVertex2f(x,y)
1946 End Sub
1947 Sub Vertex(x As GLfloat, y As GLfloat, z As GLfloat)
1948 glVertex3f(x,y,z)
1949 End Sub
1950 Sub Vertex(x As GLfloat, y As GLfloat, z As GLfloat, w As GLfloat)
1951 glVertex4f(x,y,z,w)
1952 End Sub
1953
1954 Sub Viewport(x As GLint, y As GLint, width As GLsizei, height As GLsizei)
1955 glViewport(x, y, width, height)
1956 End Sub
1957End Class
1958
1959
1960
1961#endif
Note: See TracBrowser for help on using the repository browser.