BufferAttributeUsage.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>Buffer Attribute Usage Constants</h1>
  11. <p>
  12. The usage constants can be used to provide a hint to the API regarding how
  13. the geometry buffer attribute will be used in order to optimize
  14. performance.
  15. </p>
  16. <h2>Code Example</h2>
  17. <code>
  18. const geometry = new THREE.BufferGeometry();
  19. const positionAttribute = new THREE.BufferAttribute( array, 3 , false );
  20. positionAttribute.setUsage( THREE.DynamicDrawUsage );
  21. geometry.setAttribute( 'position', positionAttribute );
  22. </code>
  23. <h2>Examples</h2>
  24. <p>[example:webgl_buffergeometry_drawrange materials / buffergeometry / drawrange ]</p>
  25. <h2>Geometry Usage</h2>
  26. <code>
  27. THREE.StaticDrawUsage
  28. THREE.DynamicDrawUsage
  29. THREE.StreamDrawUsage
  30. THREE.StaticReadUsage
  31. THREE.DynamicReadUsage
  32. THREE.StreamReadUsage
  33. THREE.StaticCopyUsage
  34. THREE.DynamicCopyUsage
  35. THREE.StreamCopyUsage
  36. </code>
  37. For more detailed information on each of these constants see
  38. [link:https://www.khronos.org/opengl/wiki/Buffer_Object#Buffer_Object_Usage this OpenGL documentation].
  39. <h2>Source</h2>
  40. <p>
  41. [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
  42. </p>
  43. </body>
  44. </html>