如何使用SDL与OGRE? [英] How to use SDL with OGRE?

查看:272
本文介绍了如何使用SDL与OGRE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 OGRE SDL (如本文中所述),我似乎遇到了问题在我的主渲染窗口后面出现的第二个窗口。基本上,我使用的代码是:

  SDL_init(SDL_INIT_VIDEO); 
SDL_Surface * screen = SDL_SetVideoMode(640,480,0,SDL_OPENGL);

Ogre :: Root * root = new Ogre :: Root();
root-> restoreConfig();
root-> initialise(false);

Ogre :: NameValuePairList windowSettings;
windowSettings [currentGLContext] = Ogre :: String(True);
Ogre :: RenderWindow * window = root-> createRenderWindow(MainRenderWindow,640,480,false,& windowSettings);
window-> setVisible(true);问题是,如何摆脱额外的窗口?




< b

对于后代,我使用OGRE 1.6.4,Mac OS X 10.6.2和SDL 1.2.14。

解决方案

我结束了我自己的这个。问题最终是OGRE的Mac GL后端不支持 currentGLContext 选项,所以最好的解决方案是更改为SDL 1.3(直接从Subversion,在写入时),并使用 SDL_CreateWindowFrom 调用从OGRE创建的窗口开始获取事件。还应该注意,OGRE窗口需要将 macAPI 设置为可可,否则SDL不会识别窗口句柄。


When I go to use OGRE with SDL (as described in this article), I seem to be having trouble with a second window that appears behind my main render window. Basically, the code I'm using is this:

SDL_init(SDL_INIT_VIDEO);
SDL_Surface *screen = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL);

Ogre::Root *root = new Ogre::Root();
root->restoreConfig();
root->initialise(false);

Ogre::NameValuePairList windowSettings;
windowSettings["currentGLContext"] = Ogre::String("True");
Ogre::RenderWindow *window = root->createRenderWindow("MainRenderWindow", 640, 480, false, &windowSettings);
window->setVisible(true);

The question is, how do I get rid of the extra window?

Just for posterity, I'm using OGRE 1.6.4, Mac OS X 10.6.2, and SDL 1.2.14.

解决方案

I ended up figuring this out on my own. The problem ends up being that OGRE's Mac GL backend does not honor the currentGLContext option, so the best solution is to change to SDL 1.3 (directly from Subversion, as of time of writing) and use the SDL_CreateWindowFrom call to start getting events from a window created by OGRE. It should also be noted that the OGRE window needs to have the macAPI set to cocoa, or else SDL won't recognize the window handle.

这篇关于如何使用SDL与OGRE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆