Design.MultipleShaderPrograms - lidavidm/jsglet GitHub Wiki
Uses
- Render some objects as particles, other textured, etc.
Needs and Considerations
-
Switching programs is an expensive operation - try to draw all objects from a particular program at once
-
Much code is tightly coupled to the program
-
They need metadata from the shaders, such as attribute locations
-
In this case: establish a consistent scheme for attribute location numbering
vertex = 0 color = 1 texture = 2 normal = 3 etc.
-
-
Implementation
-
CompositeProgram- Manages a collection of
Programs - Provides consistent access to needed metadata
- Should eliminate need to manipulate OpenGL program object directly
- Manages a collection of
-
MultiBufferObjectslive in a certainProgramDomainwhich contains the program-specific info (perhaps just make this part of theProgramobject)- Can switch domains/programs if needed