korlibs / korlibs/korge

Need better FBO handling

Open
#405 3 comments 0 reactions 0 assignees View on GitHub
enhancement feature request
Dominant language
Kotlin
Stars
3k
Forks
148
Avg merge
13h 44m
Merged PRs (30d)
1

Description

Hi,
would be nice to have such feature:

```
val fbo = FBO(512,512) <--- declare fbo somewhere(once)

//in render loop
fbo.render{
renderCubeOrSomething(usingCustomShader)
}

fbo.texture <--- now it has the scene rendered and we can use it as texture
```

I know there is already the function AG.renderToTexture, but it has 2 problems:
1. It allocates(and frees) FBO every frame.
2. It is cumbersome to use (need to create class inheriting from RenderContext (or View??) and write alot of boilerplate.

So the easiest fix is to expose AG.renderBuffers and AG.setRenderBuffer somehow to the user
and i can take care of the rest via pullrequest.

Please let me know what do you think. Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading AG.renderToTexture and tracing its RenderContext/View path, then inspect the renderBuffers and setRenderBuffer entry points mentioned in the issue. Compare the requested persistent FBO lifecycle with the existing per-frame allocation and cleanup; done means a usable render-loop API that exposes the rendered result as a texture without that repeated allocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
computer-graphics, game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.