本文整理汇总了C++中GLRenderSystem::_switchContext方法的典型用法代码示例。如果您正苦于以下问题:C++ GLRenderSystem::_switchContext方法的具体用法?C++ GLRenderSystem::_switchContext怎么用?C++ GLRenderSystem::_switchContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLRenderSystem
的用法示例。
在下文中一共展示了GLRenderSystem::_switchContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setFullscreen
void OSXCarbonWindow::setFullscreen(bool fullScreen, unsigned int width, unsigned int height)
{
if (mIsFullScreen != fullScreen || width != mWidth || height != mHeight)
{
// Set the full screen flag
mIsFullScreen = fullScreen;
createAGLContext(mFSAA, mColourDepth);
if (mIsFullScreen)
{
GLRenderSystem *rs = static_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem());
CGLContextObj share = NULL;
aglGetCGLContext(mAGLContext, (void**)&share);
// Create the CGL context object if it doesn't already exist, sharing the AGL context.
if(!mCGLContext)
{
void *cglPixFormat;
aglGetCGLPixelFormat(mAGLPixelFormat, (void **)&cglPixFormat);
mCGLContext = OGRE_NEW OSXCGLContext(mCGLContextObj, (CGLPixelFormatObj) cglPixFormat);
}
// Create the context, keeping the current colour depth and FSAA settings
createCGLFullscreen(width, height, getColourDepth(), getFSAA(), share);
rs->_switchContext(mContext);
// Hide the Carbon window
HideWindow(mWindow);
// And tell the rendersystem to stop rendering to it too
WindowEventUtilities::_removeRenderWindow(this);
}
else
{
// Create a new AGL context and pixel format if necessary
createAGLContext(mFSAA, mColourDepth);
// Create a window if we haven't already, existence check is done within the functions
if(!mWindow)
{
if(mIsExternal)
createWindowFromExternal(mView);
else
createNewWindow(width, height, mWindowTitle);
}
// Destroy the current CGL context, we will create a new one when/if we go back to full screen
destroyCGLFullscreen();
// Set the drawable, and current context
// If you do this last, there is a moment before the rendering window pops-up
#if defined(MAC_OS_X_VERSION_10_4) && MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
aglSetDrawable(mAGLContext, GetWindowPort(mWindow));
#else
aglSetWindowRef(mAGLContext, mWindow);
#endif
aglSetCurrentContext(mAGLContext);
if(!mCarbonContext)
{
mCarbonContext = OGRE_NEW OSXCarbonContext(mAGLContext, mAGLPixelFormat);
}
GLRenderSystem *rs = static_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem());
mContext = mCarbonContext;
rs->_switchContext(mContext);
WindowEventUtilities::_addRenderWindow(this);
ShowWindow(mWindow);
SelectWindow(mWindow);
RepositionWindow(mWindow, NULL, kWindowCenterOnMainScreen);
}
mWidth = width;
mHeight = height;
}
}