Using WebGL extensions - Web APIs | MDN

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

WebGL, like its sister APIs (OpenGL and OpenGL ES), supports extensions. A complete list of extensions is available in the khronos webgl ... SkiptomaincontentSkiptosearchSkiptoselectlanguageReferencesWebAPIsWebGL:2Dand3DgraphicsforthewebUsingWebGLextensionsArticleActionsEnglish(US)Canonicalextensionnames,vendorprefixesandpreferencesNamingconventionsQueryingavailableextensionsExtensionlistEnablinganextensionExtensionobjectsSeealsoRelatedTopics WebGLAPI WebGLtutorial GettingstartedwithWebGL Adding2DcontenttoaWebGLcontext UsingshaderstoapplycolorinWebGL AnimatingobjectswithWebGL Creating3DobjectsusingWebGL UsingtexturesinWebGL LightinginWebGL AnimatingtexturesinWebGL Examplesandarticles Matrixmathfortheweb WebGLmodelviewprojection WebGLbestpractices UsingWebGLextensions Abasic2DWebGLanimationexample WebGLbyexample Interfaces WebGLRenderingContext WebGL2RenderingContext WebGLActiveInfo WebGLBuffer WebGLContextEvent WebGLFramebuffer WebGLProgram WebGLQuery WebGLRenderbuffer WebGLSampler WebGLShader WebGLShaderPrecisionFormat WebGLSync WebGLTexture WebGLTransformFeedback WebGLUniformLocation WebGLVertexArrayObject Documentation: Contribute TheMDNproject Canonicalextensionnames,vendorprefixesandpreferencesNamingconventionsQueryingavailableextensionsExtensionlistEnablinganextensionExtensionobjectsSeealsoUsingWebGLextensionsWebGL,likeitssisterAPIs(OpenGLandOpenGLES),supportsextensions.Acompletelistofextensionsisavailableinthekhronoswebglextensionregistry. Note:InWebGL,unlikeinotherGLAPIs,extensionsareonlyavailableifexplicitlyrequested. Canonicalextensionnames,vendorprefixesandpreferencesExtensionsmaybesupportedbybrowservendorsbeforebeingofficiallyratified(butonlywhentheyareindraftstage).Inthatcase,theirnamecanbeprefixedbythevendorprefix(MOZ_,WEBKIT_,etc.)ortheextensionisonlyavailableonceabrowserpreferencehasbeentoggled. Ifyouwishtoworkwiththebleedingedgeofextensions,andwanttokeepworkingonuponratification(assuming,ofcourse,thattheextensiondoesn'tchangeinincompatibleways),thatyouquerythecanonicalextensionnameaswellasthevendorextensionname.Forinstance: varext=( gl.getExtension('OES_vertex_array_object')|| gl.getExtension('MOZ_OES_vertex_array_object')|| gl.getExtension('WEBKIT_OES_vertex_array_object') ); Notethat,vendorprefixhavebeendiscouragedthusmostbrowserimplementexperimentalextensionsbehindafeatureflagratherthanvendorprefix. Thefeatureflagsare: webgl.enable-draft-extensionsinFirefox chrome://flags/#enable-webgl-draft-extensionsinChromiumbasedbrowsers(Chrome,Opera). NamingconventionsWebGLextensionsareprefixedwith"ANGLE","OES","EXT"or"WEBGL".Theseprefixesreflectoriginandintent: ANGLE_:ExtensionsthatarewrittenbytheANGLElibraryauthors. OES_andKHR_:ExtensionsthatmirrorfunctionalityfromOpenGLES(OES)orOpenGLAPIextensionsapprovedbytherespectivearchitecturereviewboards(Khronos). OVR_:Extensionsthatoptimizeforvirtualreality. EXT_:ExtensionsthatmirrorotherOpenGLESorOpenGLAPIextensions. WEBGL_:ExtensionsthatareWebGL-specificandintendedtobecompatiblewithmultiplewebbrowsers.ItshouldalsobeusedforextensionswhichoriginatedwiththeOpenGLESorOpenGLAPIs,butwhosebehaviorhasbeensignificantlyaltered. QueryingavailableextensionsTheWebGLcontextsupportsqueryingwhatextensionsareavailable. varavailable_extensions=gl.getSupportedExtensions(); TheWebGLRenderingContext.getSupportedExtensions()methodreturnsanarrayofstrings,oneforeachsupportedextension.ExtensionlistThecurrentextensionsare:Extensions ANGLE_instanced_arrays EXT_blend_minmax EXT_color_buffer_float EXT_color_buffer_half_float EXT_disjoint_timer_query EXT_float_blend Experimental EXT_frag_depth EXT_shader_texture_lod EXT_sRGB EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic EXT_texture_norm16 KHR_parallel_shader_compile OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object OVR_multiview2 WEBGL_color_buffer_float WEBGL_compressed_texture_astc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_pvrtc WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_depth_texture WEBGL_draw_buffers WEBGL_lose_context WEBGL_multi_draw EnablinganextensionBeforeanextensioncanbeusedithastobeenabledusingWebGLRenderingContext.getExtension().Forexample: varfloat_texture_ext=gl.getExtension('OES_texture_float'); Thereturnvalueisnulliftheextensionisnotsupported,oranextensionobjectotherwise.ExtensionobjectsIfanextensiondefinesspecificsymbolsorfunctionsthatarenotavailableinthecorespecificationofWebGL,theywillbeavailableontheextensionobjectreturnedbythecalltogl.getExtension().Seealso WebGLRenderingContext.getSupportedExtensions() WebGLRenderingContext.getExtension() webglreport.com webglstats.com Foundaproblemwiththispage?EditonGitHubSourceonGitHubReportaproblemwiththiscontentonGitHubWanttofixtheproblemyourself?SeeourContributionguide.Lastmodified:May11,2022,byMDNcontributors



請為這篇文章評分?