new WebGLScreen(options)
A WebGLScreen is a screen device that uses a WebGL canvas as rendering target. Note that you can also use a headless-gl instance as rendering context, in which case you can simply pass null as canvas parameter.
Parameters:
Name | Type | Argument | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The screen options. Properties
|
- Implements:
- Source:
Members
-
<readonly> canvas :CanvasElement
-
The target canvas on which will be rendered the input data.
Type:
- CanvasElement
- Source:
-
<readonly> gl :WebGLRenderingContext
-
The WebGL context used to render the input data.
Type:
- WebGLRenderingContext
- Source:
-
<readonly> inputData :*
-
This value contains the data that the screen is currently rendering.
Use Screen#setInputData to change it.
Type:
- *
- Implements:
- Source:
-
<readonly> inputFormat :ScreenInputFormat
-
This value contains the input format that the screen is expecting to render.
Use Screen#setInputFormat to change it.
Type:
- ScreenInputFormat
- Implements:
- Source:
-
<readonly> inputHeight :number
-
This value contains the height of the input that the screen is expecting to render.
Use Screen#setInputSize to change it.
Type:
- number
- Implements:
- Source:
-
<readonly> inputPitch :number
-
This value contains the pitch of the input that the screen is expecting to render.
The pitch is the actual amount of data in a pixel row. Some engines add extra data after each row in order to align the data size.
Use Screen#setInputSize to change it.
Type:
- number
- Implements:
- Source:
-
<readonly> inputWidth :number
-
This value contains the width of the input that the screen is expecting to render.
Use Screen#setInputSize to change it.
Type:
- number
- Implements:
- Source:
-
<readonly> outputHeight :number
-
This value contains the output height of the rendered data.
Use Screen#setOutputSize to change it.
Type:
- number
- Implements:
- Source:
-
<readonly> outputWidth :number
-
This value contains the output width of the rendered data.
Use Screen#setOutputSize to change it.
Type:
- number
- Implements:
- Source:
Methods
-
flushScreen()
-
Render the input data on the screen.
- Implements:
- Source:
-
setInputData(data)
-
An engine will call this function to inform the device of the new input data.
Parameters:
Name Type Description data
* The new input data.
- Implements:
- Source:
-
setInputFormat(format)
-
An engine will call this function to inform the device of the new input format.
Throw an exception if the screen device doesn't support the new input format.
Parameters:
Name Type Description format
ScreenInputFormat The new input format.
- Implements:
- Source:
-
setInputSize(width, height, pitch)
-
An engine will call this function to inform the device of the new input size.
Parameters:
Name Type Argument Description width
number The new input width.
height
number The new input height.
pitch
number <optional>
The new input pitch.
- Implements:
- Source:
-
setOutputSize(width, height)
-
Change the output size.
Parameters:
Name Type Description width
number The new output width.
height
number The new output height.
- Implements:
- Source:
-
validateInputFormat(format)
-
An engine will call this function to check if the device supports the specified input format.
Return true if the screen device supports the specified input format.
Parameters:
Name Type Description format
ScreenInputFormat The input format to validate.
- Implements:
- Source:
Returns:
- Type
- bool