markaren / threepp

C++20 port of three.js (r129)
MIT License
628 stars 59 forks source link

Render to Video? #279

Open Choons opened 1 month ago

Choons commented 1 month ago

Hi, I've been using threepp several days now and it's great! This is a question rather than an issue: does threepp have a way to render to video? If not, has anyone done this, or could give a suggestion how I could implement it? Something with GLFW + FFMPEG capturing frames, perhaps?

markaren commented 1 month ago

I'm not sure what would be the more effective procedure here, but you do have the possibility to read the underlying pixel data from the GPU from the GLRenderer.

void readPixels(const Vector2& position, const WindowSize& size, Format format, unsigned char* data)

You may also copy the framebuffer into a texture. Demo

Choons commented 1 month ago

Thanks for the leads, Mark! I'll experiment with those and report back how it goes.