Class WebGL
java.lang.Object
nl.colorize.multimedialib.renderer.webgl.WebGL
- All Implemented Interfaces:
TeaGraphics
,StageVisitor
Graphics using WebGL.
This class is limited to WebGL 1, since that is supported by all modern
browsers. For operations that are not supported natively by WebGL, most
importantly text rendering, a
<canvas>
overlay is used. This does
mean that the overlay's contents are always drawn "on top" of the WebGL
graphics, but specifically for text rendering this is usually not an issue.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
drawBackground
(ColorRGB color) void
drawCircle
(Primitive graphic, Circle circle) void
void
drawPolygon
(Primitive graphic, Polygon polygon) void
void
drawSegmentedLine
(Primitive graphic, SegmentedLine line) void
drawSprite
(Sprite sprite) void
int
int
void
init
(TeaMediaLoader mediaLoader) void
prepareStage
(Stage stage) Prepares visiting the stage.boolean
Indicates whether this visitor should visit all graphics, or only graphics that are currently visible.protected float
toGLX
(float canvasX) protected float
toGLY
(float canvasY) void
visitContainer
(Container container) Visits a container.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nl.colorize.multimedialib.renderer.teavm.TeaGraphics
getDevicePixelRatio
-
Constructor Details
-
WebGL
-
-
Method Details
-
getGraphicsMode
- Specified by:
getGraphicsMode
in interfaceTeaGraphics
-
getDisplayWidth
public int getDisplayWidth()- Specified by:
getDisplayWidth
in interfaceTeaGraphics
-
getDisplayHeight
public int getDisplayHeight()- Specified by:
getDisplayHeight
in interfaceTeaGraphics
-
init
- Specified by:
init
in interfaceTeaGraphics
-
prepareStage
Description copied from interface:StageVisitor
Prepares visiting the stage. This method is called before any of the stage's graphics are visited. It can be used to add initialization logic that should be performed before any graphics can be drawn.- Specified by:
prepareStage
in interfaceStageVisitor
-
shouldVisitAllGraphics
public boolean shouldVisitAllGraphics()Description copied from interface:StageVisitor
Indicates whether this visitor should visit all graphics, or only graphics that are currently visible.- Specified by:
shouldVisitAllGraphics
in interfaceStageVisitor
-
visitContainer
Description copied from interface:StageVisitor
Visits a container. This method does not actually need to draw the container's graphics, since the correspondingdrawX
methods will be called for all the container's children. This method will be called before the container's children are visited. It can be used to handle logic related to the container itself, for example to process children that were added or removed since the last frame update.- Specified by:
visitContainer
in interfaceStageVisitor
-
drawBackground
- Specified by:
drawBackground
in interfaceStageVisitor
-
drawSprite
- Specified by:
drawSprite
in interfaceStageVisitor
-
drawLine
- Specified by:
drawLine
in interfaceStageVisitor
-
drawSegmentedLine
- Specified by:
drawSegmentedLine
in interfaceStageVisitor
-
drawRect
- Specified by:
drawRect
in interfaceStageVisitor
-
drawCircle
- Specified by:
drawCircle
in interfaceStageVisitor
-
drawPolygon
- Specified by:
drawPolygon
in interfaceStageVisitor
-
drawText
- Specified by:
drawText
in interfaceStageVisitor
-
toGLX
protected float toGLX(float canvasX) -
toGLY
protected float toGLY(float canvasY)
-