1  #ifndef _INC_ABGL


2  #define _INC_ABGL


3 


4  #include <GL/gl.sbp>


5  #include <GL/glu.sbp>


6 


7  Class PositionOnly


8  x As GLfloat


9  y As GLfloat


10  z As GLfloat


11  Public


12  End Class


13 


14  Class 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


22  Public


23  End Class


24 


25  Type XY_FLOAT


26  x As GLfloat


27  y As GLfloat


28  End Type


29 


30  Type XY_DOUBLE


31  x As GLdouble


32  y As GLdouble


33  End Type


34 


35  Class Vector2f


36  Public /* 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 


46  Public /* destructor */


47  Sub ~Vector2f()


48  End Sub


49 


50  Public /* 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 


64  Public /* 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 


105  Public /* 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=SrcVec1SrcVec2


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.XSrcVec2.X,SrcVec1.YSrcVec2.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 


142  Protected


143  xy As XY_FLOAT


144  End Class


145 


146  Class Vector2d


147  Public /* 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 


157  Public /* destructor */


158  Sub ~Vector2d()


159  End Sub


160 


161  Public /* 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 


175  Public /* 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 


216  Public /* 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=SrcVec1SrcVec2


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.XSrcVec2.X,SrcVec1.YSrcVec2.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 


253  Public


254  xz As XY_DOUBLE


255  End Class


256 


257 


258  Type XYZ_FLOAT


259  x As GLfloat


260  y As GLfloat


261  z As GLfloat


262  End Type


263 


264  Type XYZ_DOUBLE


265  x As GLdouble


266  y As GLdouble


267  z As GLdouble


268  End Type


269 


270  Class Vector3f


271  Public /* 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 


283  Public /* destructor */


284  Sub ~Vector3f()


285  End Sub


286 


287  Public /* 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 


307  Public /* 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 


351  Public /* 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.ZSrcVec2.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.ZSrcVec1.Z*SrcVec2.Y,SrcVec1.Z*SrcVec2.XSrcVec1.X*SrcVec2.Z,SrcVec1.X*SrcVec2.YSrcVec1.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=SrcVec1SrcVec2


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.XSrcVec2.X,SrcVec1.YSrcVec2.Y,SrcVec1.ZSrcVec2.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 


392  Public


393  xyz As XYZ_FLOAT


394  End Class


395 


396  Class Vector3d


397  Public /* 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 


409  Public /* destructor */


410  Sub ~Vector3d()


411  End Sub


412 


413 


414  Public /* 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 


435  Public /* 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 


479  Public /* 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.ZSrcVec2.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.ZSrcVec1.Z*SrcVec2.Y,SrcVec1.Z*SrcVec2.XSrcVec1.X*SrcVec2.Z,SrcVec1.X*SrcVec2.YSrcVec1.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=SrcVec1SrcVec2


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.XSrcVec2.X,SrcVec1.YSrcVec2.Y,SrcVec1.ZSrcVec2.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 


520  Public


521  xyz As XYZ_DOUBLE


522  End Class


523 


524 


525  Type RGB_FLOAT


526  r As GLfloat


527  g As GLfloat


528  b As GLfloat


529  End Type


530 


531  Type RGB_DOUBLE


532  r As GLdouble


533  g As GLdouble


534  b As GLdouble


535  End Type


536 


537  Class Color3f


538  Public /* 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 


545  Public /* destructor */


546  Sub ~Color3f()


547  End Sub


548 


549  Public /* 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 


569  Public /* 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 


576  Public /* 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 


608  Public /* 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*(1s*(1(h/60(h/60) As Long)))


627  b=v*(1s)


628  Case 1


629  r=v*(1s*(h/60(h/60) As Long))


630  g=v


631  b=v*(1s)


632  Case 2


633  r=v*(1s)


634  g=v


635  b=v*(1s*(1(h/60(h/60) As Long)))


636  Case 3


637  r=v*(1s)


638  g=v*(1s*(h/60(h/60) As Long))


639  b=v


640  Case 4


641  r=v*(1s*(1(h/60(h/60) As Long)))


642  g=v*(1s)


643  b=v


644  Case 5


645  r=v


646  g=v*(1s)


647  b=v*(1s*(h/60(h/60) As Long))


648  Case 6


649  r=v


650  g=v*(1s*(1(h/60(h/60) As Long)))


651  b=v*(1s)


652  End Select


653 


654  Dim ret As Color3f(r,g,b)


655  Return ret


656  End Function


657 


658  Public


659  rgb As RGB_FLOAT


660  End Class


661 


662  Class Color3d


663  Public /* 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 


670  Public /* destructor */


671  Sub ~Color3d()


672  End Sub


673 


674  Public /* 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 


694  Public /* 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 


726  Public /* 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*(1s*(1(h/60(h/60) As Long)))


745  b=v*(1s)


746  Case 1


747  r=v*(1s*(h/60(h/60) As Long))


748  g=v


749  b=v*(1s)


750  Case 2


751  r=v*(1s)


752  g=v


753  b=v*(1s*(1(h/60(h/60) As Long)))


754  Case 3


755  r=v*(1s)


756  g=v*(1s*(h/60(h/60) As Long))


757  b=v


758  Case 4


759  r=v*(1s*(1(h/60(h/60) As Long)))


760  g=v*(1s)


761  b=v


762  Case 5


763  r=v


764  g=v*(1s)


765  b=v*(1s*(h/60(h/60) As Long))


766  Case 6


767  r=v


768  g=v*(1s*(1(h/60(h/60) As Long)))


769  b=v*(1s)


770  End Select


771 


772  Dim ret As Color3d(r,g,b)


773  Return ret


774  End Function


775  Public


776  rgb As RGB_DOUBLE


777  End Class


778 


779  Type RGBA_FLOAT


780  r As GLfloat


781  g As GLfloat


782  b As GLfloat


783  a As GLfloat


784  End Type


785 


786  Type RGBA_DOUBLE


787  r As GLdouble


788  g As GLdouble


789  b As GLdouble


790  a As GLdouble


791  End Type


792 


793  Class Color4f


794  Public /* 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 


802  Public /* destructor */


803  Sub ~Color4f()


804  End Sub


805 


806  Public /* 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 


832  Public /* 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 


840  Public /* 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 


872  Public /* 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 FromCOLORREF(c As COLORREF) As Color4f


878  Dim ret As Color4f((c and &hff)/255,(c>>8 and &hff)/255,(c>>16 and &hff)/255,1.0)


879  Return ret


880  End Function


881  Static Function FromHSV(h As GLfloat, s As GLfloat, v As GLfloat, a As GLfloat) As Color4f


882  Dim r As GLfloat


883  Dim g As GLfloat


884  Dim b As GLfloat


885  Dim a As GLfloat


886  If h<0 Then h+=360.0


887  If h>360.0 Then h=360.0


888  Select Case (h/60) As Long


889  Case 0


890  r=v


891  g=v*(1s*(1(h/60(h/60) As Long)))


892  b=v*(1s)


893  Case 1


894  r=v*(1s*(h/60(h/60) As Long))


895  g=v


896  b=v*(1s)


897  Case 2


898  r=v*(1s)


899  g=v


900  b=v*(1s*(1(h/60(h/60) As Long)))


901  Case 3


902  r=v*(1s)


903  g=v*(1s*(h/60(h/60) As Long))


904  b=v


905  Case 4


906  r=v*(1s*(1(h/60(h/60) As Long)))


907  g=v*(1s)


908  b=v


909  Case 5


910  r=v


911  g=v*(1s)


912  b=v*(1s*(h/60(h/60) As Long))


913  Case 6


914  r=v


915  g=v*(1s*(1(h/60(h/60) As Long)))


916  b=v*(1s)


917  End Select


918 


919  Dim ret As Color4f(r,g,b,a)


920  Return ret


921  End Function


922 


923  Public


924  rgba As RGBA_FLOAT


925  End Class


926 


927  Class Color4d


928 


929  Public /* constructor */


930  Sub Color4d(r As GLdouble, g As GLdouble, b As GLdouble, a As GLdouble)


931  rgba.r = r


932  rgba.g = g


933  rgba.b = b


934  rgba.a = a


935  End Sub


936 


937  Public /* destructor */


938  Sub ~Color4d()


939  End Sub


940 


941  Public /* property */


942  Function R() As GLdouble


943  Return rgba.r


944  End Function


945  Function G() As GLdouble


946  Return rgba.g


947  End Function


948  Function B() As GLdouble


949  Return rgba.b


950  End Function


951  Function A() As GLdouble


952  Return rgba.a


953  End Function


954  Sub R(r As GLdouble)


955  rgba.r = r


956  End Sub


957  Sub G(g As GLdouble)


958  rgba.g = g


959  End Sub


960  Sub B(b As GLdouble)


961  rgba.b = b


962  End Sub


963  Sub A(a As GLdouble)


964  rgba.a = a


965  End Sub


966 


967  Public /* operator */


968  Sub operator = (ByRef c As Color4d)


969  This.R=c.R


970  This.G=c.G


971  This.B=c.B


972  This.A=c.A


973  End Sub


974 


975  Public /* method */


976  ' HSBを求める式はhttp://ofo.jp/osakana/cgtips/hsb.phtmlを参考にした


977  ' Drawwing\Color.abをさらに参考にしました。


978  Function GetHue() As GLfloat


979  Dim max As GLfloat, min As GLfloat, d As GLfloat


980  max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)


981  min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)


982  d = max  min


983  If rgb.g = max Then


984  Return ((rgb.b  rgb.r) As Double / d * 60.0 + 120.0) As GLdouble


985  ElseIf rgb.b = max Then


986  Return ((rgb.r  rgb.g) As Double / d * 60.0 + 240.0) As GLdouble


987  ElseIf rgb.g < rgb.b Then


988  Return ((rgb.g  rgb.b) As Double / d * 60.0 + 360.0) As GLdouble


989  Else


990  Return ((rgb.g  rgb.b) As Double / d * 60.0) As GLdouble


991  EndIf


992  End Function


993 


994  Function GetSaturation() As GLdouble


995  Dim max As GLdouble, min As GLdouble


996  max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)


997  min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)


998  Return (max  min) / max


999  End Function


1000 


1001  Function GetVolue() As GLdouble


1002  Dim max As GLdouble


1003  max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)


1004  Return max


1005  End Function


1006 


1007  Public /* static method */


1008  Static Function FromRGB(r As GLubyte, g As GLubyte, b As GLubyte) As Color4d


1009  Dim ret As Color4d(r/255,g/255,b/255,1.0)


1010  Return ret


1011  End Function


1012  Static Function FromCOLORREF(c As COLORREF) As Color4d


1013  Dim ret As Color4d((c and &hff)/255,(c>>8 and &hff)/255,(c>>16 and &hff)/255,1.0)


1014  Return ret


1015  End Function


1016  Static Function FromHSV(h As GLdouble, s As GLdouble, v As GLdouble, a As GLdouble) As Color4d


1017  Dim r As GLdouble


1018  Dim g As GLdouble


1019  Dim b As GLdouble


1020  Dim a As GLdouble


1021  If h<0 Then h+=360.0


1022  If h>360.0 Then h=360.0


1023  Select Case (h/60) As Long


1024  Case 0


1025  r=v


1026  g=v*(1s*(1(h/60(h/60) As Long)))


1027  b=v*(1s)


1028  Case 1


1029  r=v*(1s*(h/60(h/60) As Long))


1030  g=v


1031  b=v*(1s)


1032  Case 2


1033  r=v*(1s)


1034  g=v


1035  b=v*(1s*(1(h/60(h/60) As Long)))


1036  Case 3


1037  r=v*(1s)


1038  g=v*(1s*(h/60(h/60) As Long))


1039  b=v


1040  Case 4


1041  r=v*(1s*(1(h/60(h/60) As Long)))


1042  g=v*(1s)


1043  b=v


1044  Case 5


1045  r=v


1046  g=v*(1s)


1047  b=v*(1s*(h/60(h/60) As Long))


1048  Case 6


1049  r=v


1050  g=v*(1s*(1(h/60(h/60) As Long)))


1051  b=v*(1s)


1052  End Select


1053 


1054  Dim ret As Color4f(r,g,b,a)


1055  Return ret


1056  End Function


1057 


1058  Public


1059  rgba As RGBA_DOUBLE


1060  End Class


1061 


1062 


1063  Class Light


1064  Private


1065  Const Number As GLenum


1066 


1067  Public


1068  Sub Enabled(enabled As GLboolean)


1069  If enabled Then


1070  glEnable(Number)


1071  Else


1072  glDisable(Number)


1073  End If


1074  End Sub


1075  Function Enabled() As GLboolean


1076  Dim lighting As GLboolean


1077  glGetBooleanv(Number,VarPtr(lighting))


1078  Return lighting


1079  End Function


1080 


1081  Public /* constructor */


1082  Sub Light(num As GLenum)


1083  Number=num


1084  End Sub


1085 


1086  Public


1087  Sub SetAmbient(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)


1088  Dim amb[3] As GLfloat


1089  amb[0]=red


1090  amb[1]=green


1091  amb[2]=blue


1092  amb[3]=alpha


1093  glLightfv(Number,GL_AMBIENT,amb)


1094  End Sub


1095  Sub SetAmbient(ByRef color As Color4f)


1096  Dim amb[3] As GLfloat


1097  amb[0]=color.R


1098  amb[1]=color.G


1099  amb[2]=color.B


1100  amb[3]=color.A


1101  glLightfv(Number,GL_AMBIENT,amb)


1102  End Sub


1103  Sub SetAmbient(amb As *GLfloat)


1104  glLightfv(Number,GL_AMBIENT,amb)


1105  End Sub


1106 


1107  Sub SetDiffuse(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)


1108  Dim dif[3] As GLfloat


1109  dif[0]=red


1110  dif[1]=green


1111  dif[2]=blue


1112  dif[3]=alpha


1113  glLightfv(Number,GL_DIFFUSE,dif)


1114  End Sub


1115  Sub SetDiffuse(ByRef color As Color4f)


1116  Dim dif[3] As GLfloat


1117  amb[0]=color.R


1118  amb[1]=color.G


1119  amb[2]=color.B


1120  amb[3]=color.A


1121  glLightfv(Number,GL_DIFFUSE,dif)


1122  End Sub


1123  Sub SetDiffuse(dif As *GLfloat)


1124  glLightfv(Number,GL_DIFFUSE,dif)


1125  End Sub


1126 


1127  Sub SetSpecular(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)


1128  Dim spc[3] As GLfloat


1129  spc[0]=red


1130  spc[1]=green


1131  spc[2]=blue


1132  spc[3]=alpha


1133  glLightfv(Number,GL_SPECULAR,spc)


1134  End Sub


1135  Sub SetSpecular(ByRef color As Color4f)


1136  Dim spc[3] As GLfloat


1137  amb[0]=color.R


1138  amb[1]=color.G


1139  amb[2]=color.B


1140  amb[3]=color.A


1141  glLightfv(Number,GL_SPECULAR,spc)


1142  End Sub


1143  Sub SetSpecular(spc As *GLfloat)


1144  glLightfv(Number,GL_SPECULAR,spc)


1145  End Sub


1146 


1147  Sub SetPosition(pos As *GLfloat)


1148  glLightfv(Number,GL_POSITION,pos)


1149  End Sub


1150  End Class


1151 


1152  Class Material


1153  Public


1154  Sub Ambient(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)


1155  Dim face As GLenum


1156  glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))


1157  Dim amb[3] As GLfloat


1158  amb[0]=red


1159  amb[1]=green


1160  amb[2]=blue


1161  amb[3]=alpha


1162  glMaterialfv(face,GL_AMBIENT,amb)


1163  End Sub


1164  Sub Ambient(ByRef color As Color4f)


1165  Dim face As GLenum


1166  glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))


1167  Dim amb[3] As GLfloat


1168  amb[0]=color.R


1169  amb[1]=color.G


1170  amb[2]=color.B


1171  amb[3]=color.A


1172  glMaterialfv(face,GL_AMBIENT,amb)


1173  End Sub


1174  Sub Ambient(amb As *GLfloat)


1175  glMaterialfv(face,GL_AMBIENT,amb)


1176  End Sub


1177 


1178  Sub Diffuse(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)


1179  Dim face As GLenum


1180  glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))


1181  Dim dif[3] As GLfloat


1182  dif[0]=red


1183  dif[1]=green


1184  dif[2]=blue


1185  dif[3]=alpha


1186  glMaterialfv(face,GL_DIFFUSE,dif)


1187  End Sub


1188  Sub Diffuse(ByRef color As Color4f)


1189  Dim face As GLenum


1190  glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))


1191  Dim dif[3] As GLfloat


1192  dif[0]=color.R


1193  dif[1]=color.G


1194  dif[2]=color.B


1195  dif[3]=color.A


1196  glMaterialfv(face,GL_DIFFUSE,dif)


1197  End Sub


1198  Sub Diffuse(dif As *GLfloat)


1199  glMaterialfv(face,GL_DIFFUSE,dif)


1200  End Sub


1201 


1202  Sub Specular(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)


1203  Dim face As GLenum


1204  glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))


1205  Dim spc[3] As GLfloat


1206  spc[0]=red


1207  spc[1]=green


1208  spc[2]=blue


1209  spc[3]=alpha


1210  glMaterialfv(face,GL_SPECULAR,spc)


1211  End Sub


1212  Sub Specular(ByRef color As Color4f)


1213  Dim face As GLenum


1214  glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))


1215  Dim spc[3] As GLfloat


1216  spc[0]=color.R


1217  spc[1]=color.G


1218  spc[2]=color.B


1219  spc[3]=color.A


1220  glMaterialfv(face,GL_SPECULAR,spc)


1221  End Sub


1222  Sub Specular(spc As *GLfloat)


1223  glMaterialfv(face,GL_SPECULAR,spc)


1224  End Sub


1225 


1226  Sub Shininess(shin As GLfloat)


1227  Dim face As GLenum


1228  glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))


1229  glMaterialf(face,GL_SHININESS,shin)


1230  End Sub


1231 


1232  Sub Emission(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)


1233  Dim face As GLenum


1234  glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))


1235  Dim ems[3] As GLfloat


1236  ems[0]=red


1237  ems[1]=green


1238  ems[2]=blue


1239  ems[3]=alpha


1240  glMaterialfv(face,GL_EMISSION,ems)


1241  End Sub


1242  End Class


1243 


1244  Class ModelView


1245  Public


1246  Sub LoadIdentity()


1247  Dim mode As GLenum


1248  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1249  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1250  glLoadIdentity()


1251  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1252  End Sub


1253  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)


1254  Dim mode As GLenum


1255  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1256  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1257  gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz)


1258  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1259  End Sub


1260  Sub RotateX(angle As GLdouble)


1261  Dim mode As GLenum


1262  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1263  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1264  glRotated(angle, 1.0 As GLdouble, 0.0 As GLdouble, 0.0 As GLdouble)


1265  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1266  End Sub


1267  Sub RotateX(angle As GLfloat)


1268  Dim mode As GLenum


1269  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1270  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1271  glRotatef(angle, 1.0 As GLfloat, 0.0 As GLfloat, 0.0 As GLfloat)


1272  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1273  End Sub


1274  Sub RotateY(angle As GLdouble)


1275  Dim mode As GLenum


1276  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1277  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1278  glRotated(angle, 0.0 As GLdouble, 1.0 As GLdouble, 0.0 As GLdouble)


1279  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1280  End Sub


1281  Sub RotateY(angle As GLfloat)


1282  Dim mode As GLenum


1283  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1284  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1285  glRotatef(angle, 0.0 As GLfloat, 1.0 As GLfloat, 0.0 As GLfloat)


1286  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1287  End Sub


1288  Sub RotateZ(angle As GLdouble)


1289  Dim mode As GLenum


1290  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1291  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1292  glRotated(angle, 0.0 As GLdouble, 0.0 As GLdouble, 1.0 As GLdouble)


1293  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1294  End Sub


1295  Sub RotateZ(angle As GLfloat)


1296  Dim mode As GLenum


1297  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1298  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1299  glRotatef(angle, 0.0 As GLfloat, 0.0 As GLfloat, 1.0 As GLfloat)


1300  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1301  End Sub


1302  Sub Scale(x As GLdouble, y As GLdouble, z As GLdouble)


1303  Dim mode As GLenum


1304  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1305  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1306  glScaled(x, y, z)


1307  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1308  End Sub


1309  Sub Scale(x As GLfloat, y As GLfloat, z As GLfloat)


1310  Dim mode As GLenum


1311  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1312  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1313  glScalef(x, y, z)


1314  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1315  End Sub


1316  Sub Translate(x As GLdouble, y As GLdouble, z As GLdouble)


1317  Dim mode As GLenum


1318  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1319  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1320  glTranslated(x, y, z)


1321  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1322  End Sub


1323  Sub Translate(x As GLfloat, y As GLfloat, z As GLfloat)


1324  Dim mode As GLenum


1325  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1326  If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)


1327  glTranslatef(x, y, z)


1328  If mode<>GL_MODELVIEW Then glMatrixMode(mode)


1329  End Sub


1330  End Class


1331 


1332  Class Projection


1333  Public


1334  Sub LoadIdentity()


1335  Dim mode As GLenum


1336  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1337  If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)


1338  glLoadIdentity()


1339  If mode<>GL_PROJECTION Then glMatrixMode(mode)


1340  End Sub


1341  Sub Ortho2D(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble)


1342  Dim mode As GLenum


1343  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1344  If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)


1345  gluOrtho2D(left, right, bottom, top)


1346  If mode<>GL_PROJECTION Then glMatrixMode(mode)


1347  End Sub


1348  Sub Ortho3D(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble, zNear As GLdouble, zFar As GLdouble)


1349  Dim mode As GLenum


1350  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1351  If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)


1352  glOrtho(left, right, bottom, top, zNear, zFar)


1353  If mode<>GL_PROJECTION Then glMatrixMode(mode)


1354  End Sub


1355  Sub Frustum(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble, zNear As GLdouble, zFar As GLdouble)


1356  Dim mode As GLenum


1357  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1358  If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)


1359  glFrustum(left, right, bottom, top, zNear, zFar)


1360  If mode<>GL_PROJECTION Then glMatrixMode(mode)


1361  End Sub


1362  Sub Perspective(fovy As GLdouble, aspect As GLdouble, zNear As GLdouble, zFar As GLdouble)


1363  Dim mode As GLenum


1364  glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))


1365  If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)


1366  gluPerspective(fovy, aspect, zNear, zFar)


1367  If mode<>GL_PROJECTION Then glMatrixMode(mode)


1368  End Sub


1369  End Class


1370 


1371  Class Transform


1372  Public


1373  Projection As Projection


1374  ModelView As ModelView


1375  End Class


1376 


1377  Class LightModel


1378  Public


1379  Function Ambient () As Color4f


1380  Dim amb As Color4f


1381  glGetFloatv(GL_LIGHT_MODEL_AMBIENT,VarPtr(amb.rgba))


1382  Return amb


1383  End Function


1384  Sub Ambient(amb As Color4f)


1385  glLightModelfv(GL_LIGHT_MODEL_AMBIENT,VarPtr(amb.rgba))


1386  End Sub


1387 


1388  Function LocalView() As GLboolean


1389  Dim local As GLboolean


1390  glGetBooleanv(GL_LIGHT_MODEL_LOCAL_VIEW,VarPtr(local))


1391  Return local


1392  End Function


1393  Sub LocalView(enable As GLboolean)


1394  If enable Then


1395  glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEW,GL_TRUE)


1396  Else


1397  glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEW,GL_FALSE)


1398  End If


1399  End Sub


1400 


1401  Function TwoSide() As GLboolean


1402  Dim local As GLboolean


1403  glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE,VarPtr(local))


1404  Return local


1405  End Function


1406  Sub TwoSide(enable As GLboolean)


1407  If enable Then


1408  glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE)


1409  Else


1410  glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_FALSE)


1411  End If


1412  End Sub


1413  End Class


1414 


1415  Class RenderStateManager


1416  Public /* Composiotion */


1417  LightModel As LightModel


1418 


1419  Public


1420  Function AlphaTestEnable() As GLboolean


1421  Dim alpha As GLboolean


1422  glGetBooleanv(GL_ALPHA_TEST,VarPtr(alpha))


1423  Return alpha


1424  End Function


1425  Sub AlphaTestEnable(enable As GLboolean)


1426  If enable Then


1427  glEnable(GL_ALPHA_TEST)


1428  Else


1429  glDisable(GL_ALPHA_TEST)


1430  End If


1431  End Sub


1432 


1433  Function AlphaFunction() As GLenum


1434  Dim func As GLenum


1435  glGetIntegerv(GL_ALPHA_TEST_FUNC,VarPtr(func))


1436  Return func


1437  End Function


1438  Sub AlphaFunction(func As GLenum)


1439  Dim ref As GLclampf


1440  glGetFloatv(GL_ALPHA_TEST_REF,VarPtr(ref))


1441  glAlphaFunc(func,ref)


1442  End Sub


1443 


1444  Function BlendEnable() As GLboolean


1445  Dim blend As GLboolean


1446  glGetBooleanv(GL_BLEND,VarPtr(blend))


1447  Return blend


1448  End Function


1449  Sub BlendEnable(enable As GLboolean)


1450  If enable Then


1451  glEnable(GL_BLEND)


1452  Else


1453  glDisable(GL_BLEND)


1454  End If


1455  End Sub


1456 


1457  Function BlendDestinationFactor() As GLenum


1458  Dim dfactor As GLenum


1459  glGetIntegerv(GL_BLEND_DST,VarPtr(dfactor))


1460  Return dfactor


1461  End Function


1462  Sub BlendDestinationFactor(dfactor As GLenum)


1463  Dim sfactor As GLenum


1464  glGetIntegerv(GL_BLEND_SRC,VarPtr(sfactor))


1465  glBlendFunc(sfactor,dfactor)


1466  End Sub


1467 


1468  Function BlendSourceFactor() As GLenum


1469  Dim sfactor As GLenum


1470  glGetIntegerv(GL_BLEND_SRC,VarPtr(sfactor))


1471  Return sfactor


1472  End Function


1473  Sub BlendSourceFactor(sfactor As GLenum)


1474  Dim dfactor As GLenum


1475  glGetIntegerv(GL_BLEND_DST,VarPtr(dfactor))


1476  glBlendFunc(sfactor,dfactor)


1477  End Sub


1478 


1479  Function CullFaceEnable() As GLboolean


1480  Dim cull As GLboolean


1481  glGetBooleanv(GL_CULL_FACE,VarPtr(cull))


1482  Return cull


1483  End Function


1484  Sub CullFaceEnable(enable As GLboolean)


1485  If enable Then


1486  glEnable(GL_CULL_FACE)


1487  Else


1488  glDisable(GL_CULL_FACE)


1489  End If


1490  End Sub


1491 


1492  Function CullFaceMode () As GLenum


1493  Dim mode As GLenum


1494  glGetIntegerv(GL_CULL_FACE_MODE,VarPtr(mode))


1495  Return mode


1496  End Function


1497  Sub CullFaceMode(mode As GLenum)


1498  glCullFace(mode)


1499  End Sub


1500 


1501  Function DepthTestEnable () As GLboolean


1502  Dim depth As GLboolean


1503  glGetBooleanv(GL_DEPTH_TEST,VarPtr(depth))


1504  Return depth


1505  End Function


1506  Sub DepthTestEnable(enable As GLboolean)


1507  If enable Then


1508  glEnable(GL_DEPTH_TEST)


1509  Else


1510  glDisable(GL_DEPTH_TEST)


1511  End If


1512  End Sub


1513 


1514  Function DepthFunction () As GLenum


1515  Dim func As GLenum


1516  glGetIntegerv(GL_DEPTH_FUNC,VarPtr(func))


1517  Return func


1518  End Function


1519  Sub DepthFunction(func As GLenum)


1520  glDepthFunc(func)


1521  End Sub


1522 


1523  Function DepthBufferWritable() As GLboolean


1524  Dim writable As GLboolean


1525  glGetBooleanv(GL_DEPTH_WRITEMASK,VarPtr(writable))


1526  Return writable


1527  End Function


1528  Sub DepthBufferWritable(enable As GLboolean)


1529  If enable Then


1530  glDepthMask(GL_DEPTH_WRITEMASK)


1531  Else


1532  glDepthMask(GL_DEPTH_WRITEMASK)


1533  End If


1534  End Sub


1535 


1536  Function DitherEnable() As GLboolean


1537  Dim dither As GLboolean


1538  glGetBooleanv(GL_DITHER,VarPtr(dither))


1539  Return dither


1540  End Function


1541  Sub DitherEnable(enable As GLboolean)


1542  If enable Then


1543  glEnable(GL_DITHER)


1544  Else


1545  glDisable(GL_DITHER)


1546  End If


1547  End Sub


1548 


1549  Function FogEnable () As GLboolean


1550  Dim fog As GLboolean


1551  glGetBooleanv(GL_FOG,VarPtr(fog))


1552  Return fog


1553  End Function


1554  Sub FogEnable(enable As GLboolean)


1555  If enable Then


1556  glEnable(GL_FOG)


1557  Else


1558  glDisable(GL_FOG)


1559  End If


1560  End Sub


1561 


1562  Function FogMode() As GLenum


1563  Dim mode As GLenum


1564  glGetIntegerv(GL_FOG_MODE,VarPtr(mode))


1565  Return mode


1566  End Function


1567  Sub FogMode(mode As GLenum)


1568  glFogi(GL_FOG_MODE,mode)


1569  End Sub


1570 


1571  Function FogColor() As Color4f


1572  Dim ret As Color4f


1573  glGetFloatv(GL_FOG_COLOR,VarPtr(ret.rgba))


1574  Return ret


1575  End Function


1576  Sub FogColor(fcolor As Color4f)


1577  glFogfv(GL_FOG_COLOR,VarPtr(fcolor.rgba))


1578  End Sub


1579 


1580  Function FogDensity() As GLfloat


1581  Dim density As GLfloat


1582  glGetFloatv(GL_FOG_DENSITY,density)


1583  Return density


1584  End Function


1585  Sub FogDensity(density As GLfloat)


1586  glFogf(GL_FOG_DENSITY,density)


1587  End Sub


1588 


1589  Function FogStart() As GLfloat


1590  Dim fstrat As GLfloat


1591  glGetFloatv(GL_FOG_START,fstrat)


1592  Return fstrat


1593  End Function


1594  Sub FogStart(fstrat As GLfloat)


1595  glFogf(GL_FOG_START,fstrat)


1596  End Sub


1597 


1598  Function FogEnd() As GLfloat


1599  Dim fend As GLfloat


1600  glGetFloatv(GL_FOG_END,fend)


1601  Return fend


1602  End Function


1603  Sub FogEnd(fend As GLfloat)


1604  glFogf(GL_FOG_END,fend)


1605  End Sub


1606 


1607  Function Lighting() As GLboolean


1608  Dim lighting As GLboolean


1609  glGetBooleanv(GL_LIGHTING,VarPtr(lighting))


1610  Return lighting


1611  End Function


1612  Sub Lighting(enable As GLboolean)


1613  If enable Then


1614  glEnable(GL_LIGHTING)


1615  Else


1616  glDisable(GL_LIGHTING)


1617  End If


1618  End Sub


1619 


1620  Function LineSmoothEnable() As GLboolean


1621  Dim smooth As GLboolean


1622  glGetBooleanv(GL_LINE_SMOOTH,VarPtr(smooth))


1623  Return smooth


1624  End Function


1625  Sub LineSmoothEnable(enable As GLboolean)


1626  If enable Then


1627  glEnable(GL_LINE_SMOOTH)


1628  Else


1629  glDisable(GL_LINE_SMOOTH)


1630  End If


1631  End Sub


1632 


1633  Function LogicOpEnable() As GLboolean


1634  Dim logic As GLboolean


1635  glGetBooleanv(GL_COLOR_LOGIC_OP,VarPtr(logic))


1636  Return logic


1637  End Function


1638  Sub LogicOpEnable(enable As GLboolean)


1639  If enable Then


1640  glEnable(GL_COLOR_LOGIC_OP)


1641  Else


1642  glDisable(GL_COLOR_LOGIC_OP)


1643  End If


1644  End Sub


1645 


1646  Function LogicOpCode() As GLenum


1647  Dim code As GLenum


1648  glGetFloatv(GL_COLOR_LOGIC_OP_MODE,code)


1649  Return code


1650  End Function


1651  Sub LogicOpCode(code As GLenum)


1652  glLogicOp(code)


1653  End Sub


1654 


1655  Function PointSmoothEnable() As GLboolean


1656  Dim smooth As GLboolean


1657  glGetBooleanv(GL_POINT_SMOOTH,VarPtr(smooth))


1658  Return smooth


1659  End Function


1660  Sub PointSmoothEnable(enable As GLboolean)


1661  If enable Then


1662  glEnable(GL_POINT_SMOOTH)


1663  Else


1664  glDisable(GL_POINT_SMOOTH)


1665  End If


1666  End Sub


1667 


1668  Function PolygonSmoothEnable() As GLboolean


1669  Dim smooth As GLboolean


1670  glGetBooleanv(GL_POLYGON_SMOOTH,VarPtr(smooth))


1671  Return smooth


1672  End Function


1673  Sub PolygonSmoothEnable(enable As GLboolean)


1674  If enable Then


1675  glEnable(GL_POLYGON_SMOOTH)


1676  Else


1677  glDisable(GL_POLYGON_SMOOTH)


1678  End If


1679  End Sub


1680 


1681  Function ReferenceAlpha() As GLclampf


1682  Dim ref As GLclampf


1683  glGetFloatv(GL_ALPHA_TEST_REF,VarPtr(ref))


1684  Return ref


1685  End Function


1686  Sub ReferenceAlpha(ref As GLclampf)


1687  Dim func As GLenum


1688  glGetIntegerv(GL_ALPHA_TEST_FUNC,VarPtr(func))


1689  glAlphaFunc(func,ref)


1690  End Sub


1691 


1692  Function ShadeModel() As GLenum


1693  Dim mode As GLenum


1694  glGetIntegerv(GL_SHADE_MODEL,VarPtr(mode))


1695  Return mode


1696  End Function


1697  Sub ShadeModel(mode As GLenum)


1698  glShadeModel(mode)


1699  End Sub


1700  End Class


1701 


1702 


1703  Enum ColorType


1704  RgbColor=0


1705  RgbaColor=0


1706  IndexColor


1707  End Enum


1708 


1709  Enum BufferType


1710  SingleBuffer=0


1711  DoubleBuffer


1712  End Enum


1713 


1714  Enum ClearBuffer


1715  DepthBufferBit = &H00000100


1716  AccumBufferBit = &H00000200


1717  StencilBufferBit = &H00000400


1718  ColorBufferBit = &H00004000


1719  End Enum


1720 


1721  Enum PrimitiveMode


1722  Points = &H0000


1723  Lines = &H0001


1724  LineLoop = &H0002


1725  LineStrip = &H0003


1726  Triangles = &H0004


1727  TriangleStrip = &H0005


1728  TriangleFan = &H0006


1729  Quads = &H0007


1730  QuadStrip = &H0008


1731  Polygon = &H0009


1732  End Enum


1733 


1734  Class RenderingContext


1735  Public /* Composiotion */


1736  Material As Material


1737  RenderState As RenderStateManager


1738  Transform As Transform


1739  Lights[ELM(8)] As Light


1740 


1741  Public /* Constructor */


1742  Sub RenderingContext()


1743  Dim hrc As HGLRC


1744  hrc=wglGetCurrentContext()


1745  If hrc Then


1746  wglMakeCurrent(NULL,NULL)


1747  wglDeleteContext(hrc)


1748  End If


1749 


1750  Lights[0].Light(GL_LIGHT0)


1751  Lights[1].Light(GL_LIGHT1)


1752  Lights[2].Light(GL_LIGHT2)


1753  Lights[3].Light(GL_LIGHT3)


1754  Lights[4].Light(GL_LIGHT4)


1755  Lights[5].Light(GL_LIGHT5)


1756  Lights[6].Light(GL_LIGHT6)


1757  Lights[7].Light(GL_LIGHT7)


1758  End Sub


1759  Sub RenderingContext(hdc As HDC, ByRef pfd As PIXELFORMATDESCRIPTOR)


1760  RenderingContext()


1761 


1762  Dim pf As Long


1763  pf=ChoosePixelFormat(hdc,pfd)


1764  If pf=0 Then


1765  MessageBox(NULL,"Choose Pixel Format failed","error",MB_OK)


1766  Exit Sub


1767  End If


1768  If SetPixelFormat(hdc,pf,pfd)=FALSE Then


1769  MessageBox(NULL,"Set Pixel Format failed","error",MB_OK)


1770  Exit Sub


1771  End If


1772 


1773  Dim hrc As HGLRC


1774  hrc=wglCreateContext(hdc)


1775  wglMakeCurrent(hdc,hrc)


1776  End Sub


1777  Sub RenderingContext(hdc As HDC, ByRef ctype As ColorType, ByRef btype As BufferType)


1778  RenderingContext()


1779 


1780  Dim pfd As PIXELFORMATDESCRIPTOR


1781  pfd.nSize=SizeOf(PIXELFORMATDESCRIPTOR) As Word


1782  pfd.nVersion=GL_VERSION_1_1


1783  If btype=BufferType.DoubleBuffer As Long Then


1784  pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER


1785  Else


1786  pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL


1787  End If


1788  If ctype=ColorType.RgbColor As Long Then


1789  pfd.iPixelType=PFD_TYPE_RGBA


1790  Else


1791  pfd.iPixelType=PFD_TYPE_COLORINDEX


1792  End If


1793  pfd.cColorBits=24


1794  pfd.cRedBits=0


1795  pfd.cRedShift=0


1796  pfd.cGreenBits=0


1797  pfd.cGreenShift=0


1798  pfd.cBlueBits=0


1799  pfd.cBlueShift=0


1800  pfd.cAlphaBits=0


1801  pfd.cAlphaShift=0


1802  pfd.cAccumBits=0


1803  pfd.cAccumRedBits=0


1804  pfd.cAccumGreenBits=0


1805  pfd.cAccumBlueBits=0


1806  pfd.cAccumAlphaBits=0


1807  pfd.cDepthBits=32


1808  pfd.cStencilBits=0


1809  pfd.cAuxBuffers=0


1810  pfd.iLayerType=PFD_MAIN_PLANE


1811  pfd.bReserved=0


1812  pfd.dwLayerMask=0


1813  pfd.dwVisibleMask=0


1814  pfd.dwDamageMask=0


1815  RenderingContext(hdc,pfd)


1816  End Sub


1817  Sub RenderingContext(hdc As HDC)


1818  RenderingContext(hdc As HDC, ColorType.RgbColor, BufferType.DoubleBuffer)


1819  End Sub


1820 


1821  Public /* Destructor */


1822  Sub ~RenderingContext()


1823  Dim hrc As HGLRC


1824  hrc=wglGetCurrentContext()


1825  wglMakeCurrent(NULL,NULL)


1826  wglDeleteContext(hrc)


1827  End Sub


1828 


1829  Public /* Method */


1830  Sub Begin(mode As GLenum)


1831  glBegin(mode)


1832  End Sub


1833  Sub Begin(mode As PrimitiveMode)


1834  glBegin(mode)


1835  End Sub


1836  Sub Clear(mask As GLbitfield)


1837  glClear(mask)


1838  End Sub


1839  Sub Clear(mask As ClearBuffer)


1840  glClear(mask)


1841  End Sub


1842 


1843  Sub ClearAccum(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)


1844  glClearAccum(red, green, blue, alpha)


1845  End Sub


1846  Sub ClearAccum(color As Color4f)


1847  glClearAccum(color.R, color.G, color.B, color.A)


1848  End Sub


1849  Sub ClearColor(red As GLclampf, green As GLclampf, blue As GLclampf, alpha As GLclampf)


1850  glClearColor(red, green, blue, alpha)


1851  End Sub


1852  Sub ClearColor(color As Color4f)


1853  glClearColor(color.R, color.G, color.B, color.A)


1854  End Sub


1855  Sub ClearDepth(depth As GLclampd)


1856  glClearDepth(depth)


1857  End Sub


1858  Sub ClearIndex(c As GLfloat)


1859  glClearIndex(c)


1860  End Sub


1861  Sub ClearStencil(s As GLint)


1862  glClearStencil(s)


1863  End Sub


1864 


1865  Sub Color(red As GLdouble, green As GLdouble, blue As GLdouble)


1866  glColor3d(red,green,blue)


1867  End Sub


1868  Sub Color(red As GLdouble, green As GLdouble, blue As GLdouble, alpha As GLdouble)


1869  glColor4d(red,green,blue,alpha)


1870  End Sub


1871  Sub Color(red As GLfloat, green As GLfloat, blue As GLfloat)


1872  glColor3f(red,green,blue)


1873  End Sub


1874  Sub Color(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)


1875  glColor4f(red,green,blue,alpha)


1876  End Sub


1877  Sub Color(c As Color3f)


1878  glColor3fv(VarPtr(c.rgb))


1879  End Sub


1880  Sub Color(c As Color4f)


1881  glColor4fv(VarPtr(c.rgba))


1882  End Sub


1883  Sub Color(c As Color3d)


1884  glColor3dv(VarPtr(c.rgb))


1885  End Sub


1886  Sub Color(c As Color4d)


1887  glColor4dv(VarPtr(c.rgba))


1888  End Sub


1889 


1890  Sub DrawPrimiteve()


1891  End Sub


1892 


1893  Sub End()


1894  glEnd()


1895  End Sub


1896 


1897  Sub Finish()


1898  glFinish()


1899  End Sub


1900  Sub Flush()


1901  glFlush()


1902  End Sub


1903 


1904  Function GenerateTexures() As GLint


1905  glGenTextures()


1906  End Function


1907 


1908  Sub MatrixMode(mode As GLenum)


1909  glMatrixMode(mode)


1910  End Sub


1911 


1912  Sub Present()


1913  SwapBuffers(wglGetCurrentDC())


1914  End Sub


1915  Sub Present(hdc As HDC)


1916  SwapBuffers(hdc)


1917  End Sub


1918 


1919  Sub PopMatrix()


1920  glPopMatrix()


1921  End Sub


1922 


1923  Sub PushMatrix()


1924  glPushMatrix()


1925  End Sub


1926 


1927  Sub Vertex(x As GLdouble, y As GLdouble)


1928  glVertex2d(x,y)


1929  End Sub


1930  Sub Vertex(x As GLdouble, y As GLdouble, z As GLdouble)


1931  glVertex3d(x,y,z)


1932  End Sub


1933  Sub Vertex(x As GLdouble, y As GLdouble, z As GLdouble, w As GLdouble)


1934  glVertex4d(x,y,z,w)


1935  End Sub


1936  Sub Vertex(x As GLfloat, y As GLfloat)


1937  glVertex2f(x,y)


1938  End Sub


1939  Sub Vertex(x As GLfloat, y As GLfloat, z As GLfloat)


1940  glVertex3f(x,y,z)


1941  End Sub


1942  Sub Vertex(x As GLfloat, y As GLfloat, z As GLfloat, w As GLfloat)


1943  glVertex4f(x,y,z,w)


1944  End Sub


1945 


1946  Sub Viewport(x As GLint, y As GLint, width As GLsizei, height As GLsizei)


1947  glViewport(x, y, width, height)


1948  End Sub


1949  End Class


1950 


1951 


1952 


1953  #endif

