Using WebGL extensions - Web APIs | MDN
文章推薦指數: 80 %
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
延伸文章資訊
- 1WebGLRenderingContext - Web APIs | MDN
To get an access to a WebGL context for 2D and/or 3D graphics rendering, call getContext() on a <...
- 2Using WebGL extensions - Web APIs | MDN
WebGL, like its sister APIs (OpenGL and OpenGL ES), supports extensions. A complete list of exten...
- 3Using textures in WebGL - Web APIs | MDN
- 4WebGL tutorial - Web APIs | MDN
WebGL 讓網頁內容可以使用一個基於 OpenGL ES 2.0 的API以在HTML 中執行3D渲染,且瀏覽器無需使用任何plug-in。WebGL programs 由JavaScript...
- 5WebGL - Web APIs | MDN
WebGL (Web Graphics Library) 是一個透過瀏覽器渲染3D及2D圖像的 JavaScript API ,且不需要安裝任何插件。 WebGL 透過與OpenGL ES 2....