new AxWebGLGraphicsDevice()
Creates a new graphics device
Methods
BeginScene()
Begins rendering a new scene.
This method should be called before rendering a new frame
ClearDepthBuffer()
Clears the depth buffer
ClearScreen(color)
Clears the frame buffer with a specified color
Parameters:
Name | Type | Description |
---|---|---|
color |
AxVector4 | Color to cleare the frame buffer with |
CreateMesh() → {AxGraphicsDeviceMesh}
Creates a new mesh for the respective device
Returns:
New mesh for the respective device
- Type
- AxGraphicsDeviceMesh
CreateShader() → {AxDeviceShader}
Creates a new shader for the respective device
Returns:
New shader for the respective device
- Type
- AxDeviceShader
CreateTexture() → {AxDeviceTexture2D}
Creates a new texture for the respective device
Returns:
New texture for the respective device
- Type
- AxDeviceTexture2D
EndScene()
Ends rendering of a scene.
This method should be called after all rendering in a frame is done
GetGLContext(canvas) → {WebGLContext}
Gets a GL context from the given canvas element
Parameters:
Name | Type | Description |
---|---|---|
canvas |
Canvas | The canvas element to get GL context from |
Returns:
If succeeded, a GL context is returned. If failed null is returned
- Type
- WebGLContext
GetPixelFormat() → {AxPixelFormat}
Gets the pixel format of the device
Returns:
The pixel format of the device
- Type
- AxPixelFormat
Present() → {Boolean}
Presents the frame buffer on the screen to the set rendering target window
Returns:
True if presenting succeeded.
- Type
- Boolean
RenderMesh()
Renders the mesh set to the device using the set shader and device settings
SetMesh(mesh)
Sets the mesh to render
Parameters:
Name | Type | Description |
---|---|---|
mesh |
AxDeviceMesh | The mesh to be rendered |
SetRenderState(renderState)
Sets the render state
The render state represents a set of settings for the graphics device
Parameters:
Name | Type | Description |
---|---|---|
renderState |
AxRenderState | The rendering state to be set |
SetRenderTargetTexture(texture) → {Bool}
Sets a target texture to render onto
Parameters:
Name | Type | Description |
---|---|---|
texture |
AxDeviceTexture2D | Texture to use for rendering onto |
Returns:
True if the render target was set successfully
- Type
- Bool
SetRenderTargetWindow(windowHandle) → {Bool}
Sets a target window for presenting the rendering result
Parameters:
Name | Type | Description |
---|---|---|
windowHandle |
Canvas | Canvas to use for presenting the rendering result |
Returns:
New mesh for the respective device
- Type
- Bool
SetShader(shader)
Sets the rendering shader
Parameters:
Name | Type | Description |
---|---|---|
shader |
AxDeviceShader | The shader to be set |
SetViewport(x, y, width, height)
Sets the viewport of the frame buffer
Parameters:
Name | Type | Description |
---|---|---|
x |
Integer | Left boundary in pixels of the viewport |
y |
Integer | Top boundary in pixels of the viewport |
width |
Integer | Width in pixels of the viewport |
height |
Integer | Height in pixels of the viewport |