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