GlStateGuardBackend
abstract class GlStateGuardBackend
Implements: IStateGuardBackend
Known subtypes: Lwjgl2StateGuardBackend, Lwjgl3StateGuardBackend
Package: dev.joid.base.opengl.snapshot · Module: base-opengl · Source: GlStateGuardBackend.java
Backends: LWJGL 2 LWJGL 3
The base of the state guard backends of OpenGL: the surface of a snapshot backend, the traps each context supports and the state read through a binding.
Description
Section titled “Description”A subclass sets the traps and draws like a host with the OpenGL functions of its library; Lwjgl2StateGuardBackend and Lwjgl3StateGuardBackend are the two official ones.
It ships in the snapshot jar of base-opengl and in the dev and demo jars of the backends; the published joid-base-opengl jar does not hold it.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| GlStateGuardBackend(ISnapshotBackend backend, Supplier | Creates the backend over that snapshot backend; the supplier gives the binding through which it reads the state, once the snapshot backend has created its context. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
void | create(int width, int height) | Creates the surface of the snapshot backend. |
void | destroy() | Destroys the surface of the snapshot backend. |
void | present() | Presents the surface of the snapshot backend. |
SnapshotImage | capture(int width, int height) | Captures the surface of the snapshot backend. |
String | getRenderer() | Returns the renderer of the snapshot backend. |
void | inject(StateTrap trap) | Sets that trap through injectTrap; EVERYTHING sets every trap that the context supports. |
boolean | supports(StateTrap trap) | If true, the context can set the trap: the fixed-function traps need a compatibility context, the others the capability they use, read from the GlRenderBridge registered. |
Map<String,String> | readState() | Returns the state of the context, read by GlStateSnapshot with the materials of readMaterial. |
boolean | isCompatibility() protected | If true, the context has a compatibility profile. |
GlCapabilities | getCapabilities() protected | Returns the capabilities of the GlRenderBridge registered. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
void | injectTrap(StateTrap trap) hook abstract protected | Sets that trap, never EVERYTHING, in the state of the context. |
void | readMaterial(int face, int name, float[] values) hook abstract protected | Writes the four values of that material parameter of that face into the array. |
Creation details
Section titled “Creation details”GlStateGuardBackend
Section titled “GlStateGuardBackend”GlStateGuardBackend(ISnapshotBackend backend, Supplier<IGlBinding> bindings) protected
Creates the backend over that snapshot backend; the supplier gives the binding through which it reads the state, once the snapshot backend has created its context.
Method details
Section titled “Method details”create
Section titled “create”void create(int width, int height)
Creates the surface of the snapshot backend.
destroy
Section titled “destroy”void destroy()
Destroys the surface of the snapshot backend.
present
Section titled “present”void present()
Presents the surface of the snapshot backend.
capture
Section titled “capture”SnapshotImage capture(int width, int height)
Captures the surface of the snapshot backend.
getRenderer
Section titled “getRenderer”String getRenderer()
Returns the renderer of the snapshot backend.
inject
Section titled “inject”void inject(StateTrap trap)
Sets that trap through injectTrap; EVERYTHING sets every trap that the context supports.
supports
Section titled “supports”boolean supports(StateTrap trap)
If true, the context can set the trap: the fixed-function traps need a compatibility context, the others the capability they use, read from the GlRenderBridge registered.
readState
Section titled “readState”Map<String,String> readState()
Returns the state of the context, read by GlStateSnapshot with the materials of readMaterial.
isCompatibility
Section titled “isCompatibility”boolean isCompatibility() protected
If true, the context has a compatibility profile.
getCapabilities
Section titled “getCapabilities”GlCapabilities getCapabilities() protected
Returns the capabilities of the GlRenderBridge registered.
injectTrap
Section titled “injectTrap”void injectTrap(StateTrap trap) hook abstract protected
Sets that trap, never EVERYTHING, in the state of the context.
readMaterial
Section titled “readMaterial”void readMaterial(int face, int name, float[] values) hook abstract protected
Writes the four values of that material parameter of that face into the array.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
