Changeset 52 for Include/abgl.ab


Ignore:
Timestamp:
Jan 8, 2007, 1:47:28 AM (18 years ago)
Author:
NoWest
Message:

Add Methods to Material and Light Classes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/abgl.ab

    r37 r52  
    210210    End Function
    211211
    212 Public
     212Public /* constructor */
    213213    Sub Light(num As GLenum)
    214214        Number=num
     
    216216
    217217Public
    218     Sub SetAmbient(amb As *GLdouble)
    219         glLightdv(Number,GL_AMBIENT,amb)
     218    Sub SetAmbient(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
     219        Dim amb[3] As GLfloat
     220        amb[0]=red
     221        amb[1]=green
     222        amb[2]=blue
     223        amb[3]=alpha
     224        glLightfv(Number,GL_AMBIENT,amb)
     225    End Sub
     226    Sub SetAmbient(color As Color4f)
     227        Dim amb[3] As GLfloat
     228        amb[0]=color.R
     229        amb[1]=color.G
     230        amb[2]=color.B
     231        amb[3]=color.A
     232        glLightfv(Number,GL_AMBIENT,amb)
    220233    End Sub
    221234    Sub SetAmbient(amb As *GLfloat)
     
    223236    End Sub
    224237
    225     Sub SetDiffuse(dif As *GLdouble)
    226         glLightdv(Number,GL_DIFFUSE,dif)
     238    Sub SetDiffuse(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
     239        Dim dif[3] As GLfloat
     240        dif[0]=red
     241        dif[1]=green
     242        dif[2]=blue
     243        dif[3]=alpha
     244        glLightfv(Number,GL_DIFFUSE,dif)
     245    End Sub
     246    Sub SetDiffuse(color As Color4f)
     247        Dim dif[3] As GLfloat
     248        amb[0]=color.R
     249        amb[1]=color.G
     250        amb[2]=color.B
     251        amb[3]=color.A
     252        glLightfv(Number,GL_DIFFUSE,dif)
    227253    End Sub
    228254    Sub SetDiffuse(dif As *GLfloat)
     
    230256    End Sub
    231257
    232     Sub SetSpecular(spc As *GLdouble)
    233         glLightdv(Number,GL_SPECULAR,spc)
     258    Sub SetSpecular(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
     259        Dim spc[3] As GLfloat
     260        spc[0]=red
     261        spc[1]=green
     262        spc[2]=blue
     263        spc[3]=alpha
     264        glLightfv(Number,GL_SPECULAR,spc)
     265    End Sub
     266    Sub SetSpecular(color As Color4f)
     267        Dim spc[3] As GLfloat
     268        amb[0]=color.R
     269        amb[1]=color.G
     270        amb[2]=color.B
     271        amb[3]=color.A
     272        glLightfv(Number,GL_SPECULAR,spc)
    234273    End Sub
    235274    Sub SetSpecular(spc As *GLfloat)
     
    237276    End Sub
    238277
    239     Sub SetPosition(pos As *GLdouble)
    240         glLightdv(Number,GL_POSITION,pos)
    241     End Sub
    242278    Sub SetPosition(pos As *GLfloat)
    243279        glLightfv(Number,GL_POSITION,pos)
     
    257293        glMaterialfv(face,GL_AMBIENT,amb)
    258294    End Sub
     295    Sub Ambient(color As Color4f)
     296        Dim face As GLenum
     297        glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
     298        Dim amb[3] As GLfloat
     299        amb[0]=color.R
     300        amb[1]=color.G
     301        amb[2]=color.B
     302        amb[3]=color.A
     303        glMaterialfv(face,GL_AMBIENT,amb)
     304    End Sub
     305    Sub Ambient(amb As *GLfloat)
     306        glMaterialfv(face,GL_AMBIENT,amb)
     307    End Sub
     308
    259309    Sub Diffuse(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
    260310        Dim face As GLenum
     
    267317        glMaterialfv(face,GL_DIFFUSE,dif)
    268318    End Sub
     319    Sub Diffuse(color As Color4f)
     320        Dim face As GLenum
     321        glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
     322        Dim dif[3] As GLfloat
     323        dif[0]=color.R
     324        dif[1]=color.G
     325        dif[2]=color.B
     326        dif[3]=color.A
     327        glMaterialfv(face,GL_DIFFUSE,dif)
     328    End Sub
     329    Sub Diffuse(dif As *GLfloat)
     330        glMaterialfv(face,GL_DIFFUSE,dif)
     331    End Sub
     332
    269333    Sub Specular(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
    270334        Dim face As GLenum
     
    277341        glMaterialfv(face,GL_SPECULAR,spc)
    278342    End Sub
     343    Sub Specular(color As Color4f)
     344        Dim face As GLenum
     345        glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
     346        Dim spc[3] As GLfloat
     347        spc[0]=color.R
     348        spc[1]=color.G
     349        spc[2]=color.B
     350        spc[3]=color.A
     351        glMaterialfv(face,GL_SPECULAR,spc)
     352    End Sub
     353    Sub Specular(spc As *GLfloat)
     354        glMaterialfv(face,GL_SPECULAR,spc)
     355    End Sub
     356
    279357    Sub Shininess(shin As GLfloat)
    280358        Dim face As GLenum
     
    282360        glMaterialf(face,GL_SHININESS,shin)
    283361    End Sub
     362
    284363    Sub Emission(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
    285364        Dim face As GLenum
Note: See TracChangeset for help on using the changeset viewer.