opengl离屏渲染
我在 MAC OS X 10.6 上使用 opengl FBO 和 glut 进行离屏渲染。该程序涉及多个 3D 对象的移动。
该程序似乎工作正常,除了我需要包含一个选项,其中屏幕外缓冲区内容不会交换到屏幕缓冲区。因此您在屏幕上看不到任何内容。我想知道当屏幕上看不到任何东西时程序是否正常工作,即 3D 运动等正常工作。当我的进程单独运行时,是否有一个实用程序可以读取屏幕外缓冲区并将其显示在屏幕上。
或者,还有其他方法可以实现这一目标吗?即使用 FBO 渲染离屏时隐藏屏幕上的窗口。
感谢任何意见/建议。我希望我的问题很清楚。
I am using off screen rendering using opengl FBO and glut on a MAC OS X 10.6. The program involves movement of multiple 3D objects.
The program seems to be working fine except that I am required to include an option where the off screen buffer contents are not swapped to the on screen buffer. Hence you do not see anything on the screen. I want to know if the program is working as it should be in this mode when nothing is seen on screen - ie 3D movements etc work fine as usual. Is there a utility that can read offscreen buffer and display it onscreen while my process runs separately.
Alternatively, are there other ways to achieve this? That is to hide the onscreen window while rendering offscreen using FBO.
Appreciate any comments/suggestions. I hope I am clear in my question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
gDEBugger for Mac 至少应该能够显示 FBO 内容,而无需您付出额外的努力Windows 版本就可以做到这一点。提供 7 天试用版。
gDEBugger for Mac should be able to display the FBO content with no additional effort on your side, at least the Windows version does so just fine. A 7 days trial version is available.
我会将屏幕外缓冲区复制到共享内存上。然后,外部应用程序不断读取共享内存内容,更新纹理并将其显示在屏幕上。
就是这样。
我经常使用它,即使是离屏渲染,但我没有一个方便的例子。 :(
我建议在共享内存的开头存储附加信息(宽度、高度、像素类型、增量整数以了解图像自上次读取以来是否已更改...)。
在此标头之后,存储应用程序生成的像素数据,其大小实际上取决于宽度、高度和像素大小。
我还建议使用 glReadPixels 来存储像素数据,将映射的共享内存作为参数传递。远程应用程序可以使用该数据来更新纹理。
I would copy the offscreen buffer onto a shared memory. Then, an external application reads continuosly the shared memory contents, updates a texture and display it on the screen.
That's it.
I've used it a lot, even with off-screen rendering, but I have not a handy example. :(
I would advice to store additional information at the beginning of the shared memory (width, height, pixel type, incremental integer to know whether the image has changed from the last read...).
After this header, store the pixel data generated by you application, which size depends actually by width, height and pixel size.
I would also advice to use glReadPixels to store pixel data, passing the mapped shared memory as parameter. Remote application can use that data to update a texture.