Cinder:如何获取指向已生成但从未在屏幕上显示的数据\帧的指针?

发布于 2024-12-21 23:32:09 字数 491 浏览 2 评论 0 原文

我想使用一个名为 libCinder 的 grate lib,我查看了 其文档 但不知道是否可能以及如何渲染某些内容而不先显示它?

假设我们要创建一个简单的随机颜色 640x480 画布,上面有 3 个红白蓝圆圈,并从其中获取 RGB\HSL\any char * 原始图像数据,而不显示任何窗口用户。 (假设我们有控制台应用程序项目类型)。我想使用这样的功能来生成服务器端实时视频流,对于视频流,我更愿意使用 ffmpeg 所以这是为什么我想要一个指向某些 RGB\HSV 或具有实际图像数据的缓冲区的指针。如何使用 libCInder 来做这样的事情?

There is that grate lib I want to use called libCinder, I looked thru its docs but do not get if it is possible and how to render something with out showing it first?

Say we want to create a simple random color 640x480 canvas with 3 red white blue circles on it, and get RGB\HSL\any char * to raw image data out of it with out ever showing any windows to user. (say we have console application project type). I want to use such feaure for server side live video stream generation and for video streaming I would prefer to use ffmpeg so that is why I want a pointer to some RGB\HSV or what ever buffer with actuall image data. How to do such thing with libCInder?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

娇纵 2024-12-28 23:32:09

您将必须使用离屏渲染。就图形而言,libcinder 似乎只是 OpenGL 的包装器,因此您可以使用 OpenGL 代码来实现这一点。

由于 OpenGL 没有用于离屏渲染的本机机制,因此您必须使用扩展。可以在此处找到使用此类扩展的教程(称为“帧缓冲区渲染”)。您必须修改 renderer.cpp 才能使用此扩展的命令。

使用此类扩展的替代方法是使用 Mesa 3D,它是一个开放的-OpenGL 的源实现。 Mesa 有一个软件渲染引擎,可以在不使用显卡的情况下渲染到内存中。这意味着您不需要显卡,但另一方面渲染可能会很慢。 Mesa 在演示 zip 文件中的 src/osdemos/ 中有一个渲染到内存缓冲区的示例。此解决方案可能需要您编写一个完整的 Renderer 类,类似于将使用 MesaRenderer2dRendererGl的入侵,而不是 WindowsMac 的入侵。

You will have to use off-screen rendering. libcinder seems to be just a wrapper for OpenGL, as far as graphics go, so you can use OpenGL code to achieve this.

Since OpenGL does not have a native mechanism for off-screen rendering, you'll have to use an extension. A tutorial for using such an extension, called Framebuffer Rendering, can be found here. You will have to modify renderer.cpp to use this extension's commands.

An alternative to using such an extension is to use Mesa 3D, which is an open-source implementation of OpenGL. Mesa has a software rendering engine which allows it to render into memory without using a video card. This means you don't need a video card, but on the other hand the rendering might be slow. Mesa has an example of rendering to a memory buffer at src/osdemos/ in the Demos zip file. This solution will probably require you to write a complete Renderer class, similar to Renderer2d and RendererGl which will use Mesa's intrusctions instead of Windows's or Mac's.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文