-
Notifications
You must be signed in to change notification settings - Fork 1
Render Pipeline
miguel edited this page May 13, 2019
·
3 revisions
This chapter explains the rendering pipeline concept of braingdx. The render pipeline is accessible via the GameContext
:
RenderPipeline pipeline = context.getRenderPipeline();
The pipeline composed out of so called render layers. Each layer is stacked onto another one. braingdx renders these layers on each frame. It is also possible to apply shaders to your game. To read more about shaders, continue here.
It is possible to completely replace the existing render pipeline with your own one. By default, braingdx provides a pipeline which is general and applies to many different use cases:
-
Background this layer is used by braingdx internally to render the background defined by
setBackgroundColor
. This layer should be used for backgrounds. - Foreground this layer is for backgrounds which should be in front of the main background (e.g. for parallax scrolling)
- World this layer renders all game objects in the game
- World UI this layer renders the world stage onto the screen. Note, the world UI combined matrix is modified by the game camera automatically
- UI the UI of the game
In order to access a render pipe:
Bloom bloomShader = new Bloom(width, height);
context.getRenderPipeline().addEffects(RenderPipeIds.WORLD, bloomShader);
RenderPipeline pipeline = context.getRenderPipeline();
pipeline.put(RenderPipeIds.BACKGROUND, new RenderLayer() {
@Override
public void beforeRender() {
}
@Override
public void render(Batch batch, float delta) {
// DRAW ME!
}
});