如何在 Ogre 中获得无窗口应用程序?
我正在尝试创建一个无窗口的 Ogre 应用程序,但应用程序似乎完全忽略了 RenderWindow::setVisible(false) 方法。有办法实现吗?
谢谢
托马索
I'm trying to create a windowless Ogre application, but it seems that the method RenderWindow::setVisible(false) is completely ignored by the application. Is there a way to accomplish that?
Thank you
Tommaso
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不应该使用
RenderWindow
,而是使用RenderTexture< /code>
如果您不想打开窗口。它的工作方式几乎与 RenderWindow 完全相同,因为它也是从 RenderTarget 派生的。除了更改构造函数之外,您只需使用当前参数切换它们就应该几乎没有问题。
如果您在开关方面遇到问题,请使用一些具体代码更新您的问题。
You should not be using
RenderWindow
butRenderTexture
if you don't want to open a window. It works almost exactly the same asRenderWindow
because it is derived fromRenderTarget
as well. You should have almost no trouble just switching them around with your current parameters except for changing the constructor.Please update your question with some concrete code if you do run into trouble with the switch.
据我所知,即使您只想创建一个无窗口应用程序,您也必须创建一个窗口。不创建 RenderWindow 就无法初始化 Ogre (
window = m_root->initialise(true, "App")
)在 Ogre 1.8 中,您可以通过调用
window->setHidden(true)
来隐藏窗口通过这种方法,您可以绕过该问题并制作一个“无窗口”应用程序。
正如 Svenstaro 所说,您可以将渲染重定向到 RenderTexture 中。我使用下面的代码将帧渲染为纹理:
在 RenderLoop 中:
As far as I know you have to create a window even if you just want create a windowless app. It is not possible to initialize Ogre without creating a RenderWindow (
window = m_root->initialise(true, "App")
)With Ogre 1.8 you can hide the window by calling
window->setHidden(true)
Thanks to this method you can bypass the problem and make a "windowless" app.
As Svenstaro said, you can redirect the rendering into a RenderTexture. I use the code below to render my frames into a texture :
In the RenderLoop :