Gl.VertexAttrib3f (gb.opengl.glsl) - / - Gambas Documentation

文章推薦指數: 80 %
投票人數:10人

Gl.VertexAttrib3f (gb.opengl.glsl) ... Specifies the value of a generic vertex attribute. Parameters. index. Specifies the index of the generic vertex attribute ... Gl.VertexAttrib3f(gb.opengl.glsl) StaticSubVertexAttrib3f(IndexAsInteger,XAsFloat,YAsFloat,ZAsFloat) Specifiesthevalueofagenericvertexattribute. Parameters index Specifiestheindexofthegenericvertex attributetobemodified. v0, v1, v2, v3 Specifiesthenewvaluestobeusedforthe specifiedvertexattribute. Parameters index Specifiestheindexofthegenericvertex attributetobemodified.v Specifiesapointertoanarrayofvaluesto beusedforthegenericvertexattribute. Parameters index Specifiestheindexofthegenericvertex attributetobemodified.type Typeofpackingusedonthedata.Thisparametermustbe Gl.INT_10_10_10_2orGl.UNSIGNED_INT_10_10_10_2 tospecifysignedorunsigneddata,respectively.normalized IfGl.TRUE,thenthevaluesaretobe convertedtofloatingpointvaluesbynormalizing.Otherwise, theyareconverteddirectlytofloatingpointvalues. value Specifiesthenewpackedvaluetobeusedforthe specifiedvertexattribute. Description OpenGLdefinesanumberofstandardvertexattributesthat applicationscanmodifywithstandardAPIentrypoints(color, normal,texturecoordinates,etc.).The Gl.VertexAttribfamilyofentrypoints allowsanapplicationtopassgenericvertexattributesin numberedlocations. Genericattributesaredefinedasfour-componentvalues thatareorganizedintoanarray.Thefirstentryofthisarray isnumbered0,andthesizeofthearrayisspecifiedbythe implementation-dependentconstant Gl.MAX_VERTEX_ATTRIBS.Individualelements ofthisarraycanbemodifiedwitha Gl.VertexAttribcallthatspecifiesthe indexoftheelementtobemodifiedandavalueforthat element. Thesecommandscanbeusedtospecifyone,two,three,or allfourcomponentsofthegenericvertexattributespecifiedby index.A1inthe nameofthecommandindicatesthatonlyonevalueispassed,and itwillbeusedtomodifythefirstcomponentofthegeneric vertexattribute.Thesecondandthirdcomponentswillbesetto 0,andthefourthcomponentwillbesetto1.Similarly,a 2inthenameofthecommandindicatesthat valuesareprovidedforthefirsttwocomponents,thethird componentwillbesetto0,andthefourthcomponentwillbeset to1.A3inthenameofthecommand indicatesthatvaluesareprovidedforthefirstthree componentsandthefourthcomponentwillbesetto1,whereasa 4inthenameindicatesthatvaluesare providedforallfourcomponents. Theletterss, f,i, d,ub, us,anduiindicate whethertheargumentsareoftypeshort,float,int,double, unsignedbyte,unsignedshort,orunsignedint.When visappendedtothename,thecommandscan takeapointertoanarrayofsuchvalues. Additionalcapitalizedletterscanindicatefurtheralterations tothedefaultbehavioroftheglVertexAttribfunction: ThecommandscontainingNindicatethat theargumentswillbepassedasfixed-pointvaluesthatare scaledtoanormalizedrangeaccordingtothecomponent conversionrulesdefinedbytheOpenGLspecification.Signed valuesareunderstoodtorepresentfixed-pointvaluesinthe range/wiki/-1,1,andunsignedvaluesareunderstoodtorepresent fixed-pointvaluesintherange/wiki/0,1. ThecommandscontainingIindicatethat theargumentsareextendedtofullsignedorunsignedintegers. ThecommandscontainingPindicatethat theargumentsarestoredaspackedcomponentswithinalarger naturaltype. OpenGLShadingLanguageattributevariablesareallowedto beoftypemat2,mat3,ormat4.Attributesofthesetypesmaybe loadedusingtheGl.VertexAttribentry points.Matricesmustbeloadedintosuccessivegeneric attributeslotsincolumnmajororder,withonecolumnofthe matrixineachgenericattributeslot. Auser-definedattributevariabledeclaredinavertex shadercanbeboundtoagenericattributeindexbycalling Gl.BindAttribLocation. Thisallowsanapplicationtousemoredescriptivevariable namesinavertexshader.Asubsequentchangetothespecified genericvertexattributewillbeimmediatelyreflectedasa changetothecorrespondingattributevariableinthevertex shader. Thebindingbetweenagenericvertexattributeindexanda user-definedattributevariableinavertexshaderispartof thestateofaprogramobject,butthecurrentvalueofthe genericvertexattributeisnot.Thevalueofeachgeneric vertexattributeispartofcurrentstate,justlikestandard vertexattributes,anditismaintainedevenifadifferent programobjectisused. Anapplicationmayfreelymodifygenericvertexattributes thatarenotboundtoanamedvertexshaderattributevariable. Thesevaluesaresimplymaintainedaspartofcurrentstateand willnotbeaccessedbythevertexshader.Ifagenericvertex attributeboundtoanattributevariableinavertexshaderis notupdatedwhilethevertexshaderisexecuting,thevertex shaderwillrepeatedlyusethecurrentvalueforthegeneric vertexattribute. Notes Genericvertexattributescanbeupdatedatanytime. Itispossibleforanapplicationtobindmorethanone attributenametothesamegenericvertexattributeindex.This isreferredtoasaliasing,anditisallowedonlyifjustone ofthealiasedattributevariablesisactiveinthevertex shader,orifnopaththroughthevertexshaderconsumesmore thanoneoftheattributesaliasedtothesamelocation.OpenGL implementationsarenotrequiredtodoerrorcheckingtodetect aliasing,theyareallowedtoassumethataliasingwillnot occur,andtheyareallowedtoemployoptimizationsthatwork onlyintheabsenceofaliasing. Thereisnoprovisionforbindingstandardvertex attributes;therefore,itisnotpossibletoaliasgeneric attributeswithstandardattributes. Gl.VertexAttrib4bv,Gl.VertexAttrib4sv, Gl.VertexAttrib4iv,Gl.VertexAttrib4ubv, Gl.VertexAttrib4usv,Gl.VertexAttrib4uiv,and Gl.VertexAttrib4NversionsareavailableonlyiftheGLversionis3.1orhigher. Gl.VertexAttribPversionsareavailableonlyiftheGLversionis3.3orhigher. Errors Gl.INVALID_VALUEisgeneratedif indexisgreaterthanorequalto Gl.MAX_VERTEX_ATTRIBS. Gl.INVALID_ENUMisgeneratedif Gl.VertexAttribPisusedwitha typeotherthan Gl.INT_10_10_10_2or Gl.UNSIGNED_INT_10_10_10_2. AssociatedGets Gl.Get withtheargumentGl.CURRENT_PROGRAM Gl.GetActiveAttrib withargumentprogramandtheindexofanactive attributevariable Gl.GetAttribLocation withargumentprogramandanattribute variablename Gl.GetVertexAttrib withargumentsGl.CURRENT_VERTEX_ATTRIBand index Seealso Gl.BindAttribLocation Gl.VertexAttribPointer SeeoriginaldocumentationonOpenGLwebsite



請為這篇文章評分?