Class DrawTechniqueAbstract Internal

Base class for GPU draw techniques.

Used by DrawOps to perform actual draw calls.

A DrawTechnique encapsulates:

  • GLSL source generation (vertex + fragment)
  • WebGL program compilation/linking (WebGLProgram)
  • Uniform / sampler discovery and per-pass binding
  • Issuing draw calls for a MeshBatch

Techniques are render-pass aware but do not own render-pass routing: callers pass a RenderPassValue to drawMesh, and the technique binds uniforms accordingly.

  • Build shader sources via buildVertexShader and buildFragmentShader.
  • Compile/link the program and cache uniform/sampler locations in init.
  • Bind the program and set pass/view-dependent uniforms in _bind.
  • Bind batch data textures from GPUMemoryReader and draw primitives in _draw.
  • Call init once after construction to allocate GPU resources.
  • Call destroy to release GPU resources.
  • On WebGL context loss/restoration, call webglContextRestored to recreate state.

Subclasses must implement:

These methods are called during init to generate the GLSL source code, and would typically use helper methods like vsCode, vsHeader, and vsCommonDefines, provided by the base class, to construct the shader source (i.e. Template Method / Template Base Class pattern).

Hierarchy (View Summary)

Constructors

Properties

edges: boolean

When true, the technique binds silhouette-related uniforms using "edge" material settings (edgeColor/edgeAlpha) instead of fill settings (fillColor/fillAlpha).

Used by silhouette-like techniques that can render both filled silhouettes and edge silhouettes.

errors: string[]

Compilation errors encountered during program initialization. Available after init() is called.

fragmentShaderSrc: string

Fragment shader source code. Available after init() is called.

vertexShaderSrc: string

Vertex shader source code. Available after init() is called.

Methods