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 | uses "TBGL"
dim rquad as single
dim frameRate as double
dim hWnd as dword
dim bits as long = 32
hWnd = tbgl_createwindowex ( " - Press 'Esc' to Quit" , 640, 480, bits, %TBGL_WS_WINDOWED)
tbgl_showwindow
TYPE SuperBox_RGB
R AS BYTE
G AS BYTE
B AS BYTE
END TYPE
begin const
%top = 1
%bottom
%front
%back
% left
% right
end const
Dim CustomColor(6) as SuperBox_RGB
with CustomColor(%top)
.R = 255
.G = 255
.B = 255
end with
with CustomColor(%bottom)
.R = 255
.G = 255
.B = 0
end with
with CustomColor(%front)
.R = 255
.G = 0
.B = 0
end with
with CustomColor(%back)
.R = 0
.G = 255
.B = 255
end with
with CustomColor(% left )
.R = 0
.G = 0
.B = 255
end with
with CustomColor(% right )
.R = 255
.G = 0
.B = 255
end with
TBGL_ResetKeyState ()
while tbgl_iswindow (hWnd)
frameRate = tbgl_getframerate
tbgl_clearframe
tbgl_camera 0,0,1,0,0,0
TBGL_Translate 0.0, 0.0, -7.0
TBGL_Rotate rquad, 1.0, 1.0, 1.0
SuperBox 2, 1, 1, CustomColor
rquad -= ( 27.0 / frameRate )
tbgl_drawframe
if tbgl_getWindowkeystate (hWnd, % VK_ESCAPE ) then exit while
wend
tbgl_destroywindow
SUB SuperBox(a as single , b as single , c as single , Colors() as SuperBox_RGB )
TBGL_BeginPoly %GL_QUADS
TBGL_Color Colors(1).R, Colors(1).G, Colors(1).B
TBGL_Vertex a, b, -c
TBGL_Vertex -a, b, -c
TBGL_Vertex -a, b, c
TBGL_Vertex a, b, c
TBGL_Color Colors(2).R, Colors(2).G, Colors(2).B
TBGL_Vertex a, -b, c
TBGL_Vertex -a, -b, c
TBGL_Vertex -a, -b, -c
TBGL_Vertex a, -b, -c
TBGL_Color Colors(3).R, Colors(3).G, Colors(3).B
TBGL_Vertex a, b, c
TBGL_Vertex -a, b, c
TBGL_Vertex -a, -b, c
TBGL_Vertex a, -b, c
TBGL_Color Colors(4).R, Colors(4).G, Colors(4).B
TBGL_Vertex a, -b, -c
TBGL_Vertex -a, -b, -c
TBGL_Vertex -a, b, -c
TBGL_Vertex a, b, -c
TBGL_Color Colors(5).R, Colors(5).G, Colors(5).B
TBGL_Vertex -a, b, -c
TBGL_Vertex -a, -b, -c
TBGL_Vertex -a, -b, c
TBGL_Vertex -a, b, c
TBGL_Color Colors(6).R, Colors(6).G, Colors(6).B
TBGL_Vertex a, b, -c
TBGL_Vertex a, b, c
TBGL_Vertex a, -b, c
TBGL_Vertex a, -b, -c
TBGL_EndPoly
END SUB
|