Gl.VertexAttrib3f (gb.opengl.glsl) - / - Gambas Documentation
文章推薦指數: 80 %
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
延伸文章資訊
- 1Gl.VertexAttrib3f (gb.opengl.glsl) - / - Gambas Documentation
Gl.VertexAttrib3f (gb.opengl.glsl) ... Specifies the value of a generic vertex attribute. Paramet...
- 2WebGL入门-WebGL常用API说明详解_点燃火柴的博客
vertexAttrib3f()的同族函数7. 获取uniform变量地址gl.getUniformLocation()8. ... vertexAttrib3f(); 4.3 给attribu...
- 3在JavaScript程序通过attribute变量向顶点着色器传值 - CSDN博客
gl.vertexAttrib3f() 方法是一系列同族函数中的一个,该系列函数的任务就是从JavaScript程序中向顶点着色器中的attribute变量传值
- 4[Day5] WebGL 修羅道(2) - 資料傳遞 - iT 邦幫忙
而傳入值的話,則是使用 gl.vertexAttrib3f ,要注意attribute 這個型別只能夠用在vertex shader 中!其實在使用attribute,是先取用buffer 中的...
- 5WebGLRenderingContext.vertexAttrib[1234]f[v]() - Web APIs
const a_foobar = gl.getAttribLocation(shaderProgram, 'foobar'); //either set each component indiv...