Skip to content

Custom viewport and box2dlights

SimonIT edited this page Nov 10, 2024 · 3 revisions

Support for custom viewports, e.g. resolution independent viewports, is only available since box2dlights 1.3, if you are using an older version, please update to at least 1.3 to enable support.

For correct viewport rendering, if you are not using defaults, you should set them manually:

rayHandler.useCustomViewport(x, y, width, height);

For example, if you are using a viewport:

rayHandler.useCustomViewport(viewport.getScreenX(), viewport.getScreenY(), viewport.getScreenWidth(), viewport.getScreenHeight());

Where x, y, width and height are the values of your custom viewport. For correct rendering after resizing the window or changing the viewport size, you should manually call this method again. For example, within the resize(width, height) method.

When no longer needed, it can be reset to default:

rayHandler.useDefaultViewport();
Clone this wiki locally