-
Notifications
You must be signed in to change notification settings - Fork 146
Ownership rules for graphics objects
Steffen Ohrendorf edited this page Jul 6, 2015
·
2 revisions
Type | Global/Singleton | Owned by | Notes |
---|---|---|---|
Renderer | Yes | Engine | |
Shader manager | Yes | Renderer | Con-/destruction by renderer |
Shader descr. | No | Shader manager | Con-/destruction by shader manager |
Vertex array | No | Mesh/Room/Global | Only owned by exactly one object at a time. |
Note: Vertex arrays for GUI elements are global. This is extremely ugly, should be replaced by some Gui object owned by renderer. Code in Room should be cleaned up, too.
Objects come in two categories. Type one is global, with lifetime from initializion at app startup to app exit. There is no need for cleaning them up them (though the code does it anyway; not sure why). The other is owned by the currently loaded level. Lifetime is either from level loading to level unload (for level transition or app end), or from specific gameplay events (Lua) to another one of those. There is no need for any shared ownership.