WebGL——WebGL 资源(翻译)

  https://www.khronos.org/registry/webgl/specs/1.0/ 原文地址

3 WebGL Resources

OpenGL manages several types of resources as part of its state. These are identified by integer object names and are obtained from OpenGL by various creation calls. In contrast WebGL represents these resources as DOM objects. Each object is derived from the WebGLObject interface. Currently supported resources are: textures, buffers (i.e., VBOs), framebuffers, renderbuffers, shaders and programs. The WebGLRenderingContext interface has a method to create a WebGLObject subclass for each type. Data from the underlying graphics library are stored in these objects and are fully managed by them. The resources represented by these objects are guaranteed to exist as long as the object exists. Furthermore, the DOM object is guaranteed to exist as long as the author has an explicit valid reference to it or as long as it is bound by the underlying graphics library. When none of these conditions exist the user agent can, at any point, delete the object using the equivalent of a delete call (e.g., deleteTexture). If authors wish to control when the underlying resource is released then the delete call can be made explicitly.

3 WebGL Resources
  OpenGL将多种资源作为它的状态来管理,这些是确定的整数对象名称和从OpenGL中获得各种创建调用。与之相反,WebGL用DOM对象来表现这些资源。每个对象继承WebGLObject接口。目前支持的资源有:纹理、缓冲区、框架缓冲区、渲染缓冲区、着色器、程序集。
   WebGLRenderingContext接口具有一个为不同类创建一个WebGLObject父类的方法,从底层图形库的数据存储在这些对象中,而且有这些对象进行全权管理。只有这些对象的存在才能保证表现资源的对象存在。此外,DOM对象是保证存在只要作者有一个明确的有效的对它的引用或者只要是受底层图形库。如果没有这些条件存在,用户代理可以在任何时刻删除对象用,也相当于删除一个调用。如果作者想要在底层的资源被释放的时候控制对象,那么调用可以显式地删除了。

你可能感兴趣的:(WebGL)