本文整理汇总了C++中GLRenderSystem::_getMainContext方法的典型用法代码示例。如果您正苦于以下问题:C++ GLRenderSystem::_getMainContext方法的具体用法?C++ GLRenderSystem::_getMainContext怎么用?C++ GLRenderSystem::_getMainContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLRenderSystem
的用法示例。
在下文中一共展示了GLRenderSystem::_getMainContext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createAGLContext
void OSXCarbonWindow::createAGLContext(size_t fsaa_samples, int depth)
{
if(!mAGLContext)
{
int i = 0;
GLint attribs[ 20 ];
attribs[ i++ ] = AGL_NO_RECOVERY;
attribs[ i++ ] = GL_TRUE;
attribs[ i++ ] = AGL_ACCELERATED;
attribs[ i++ ] = GL_TRUE;
attribs[ i++ ] = AGL_RGBA;
attribs[ i++ ] = AGL_DOUBLEBUFFER;
attribs[ i++ ] = AGL_ALPHA_SIZE;
attribs[ i++ ] = 8;
attribs[ i++ ] = AGL_STENCIL_SIZE;
attribs[ i++ ] = 8;
attribs[ i++ ] = AGL_DEPTH_SIZE;
attribs[ i++ ] = depth;
if(fsaa_samples > 1)
{
attribs[ i++ ] = AGL_MULTISAMPLE;
attribs[ i++ ] = AGL_SAMPLE_BUFFERS_ARB;
attribs[ i++ ] = 1;
attribs[ i++ ] = AGL_SAMPLES_ARB;
attribs[ i++ ] = fsaa_samples;
}
#if OGRE_STEREO_ENABLE
if (mStereoEnabled)
attribs[i++] = AGL_STEREO;
#endif
attribs[ i++ ] = AGL_NONE;
mAGLPixelFormat = aglChoosePixelFormat( NULL, 0, attribs );
if(!mAGLPixelFormat)
{
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
"Unable to create a valid pixel format with selected attributes.",
"OSXCarbonWindow::createAGLContext" );
}
// Create the AGLContext from our pixel format
// Share it with main
GLRenderSystem *rs = static_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem());
OSXContext* mainContext = static_cast<OSXContext*>( rs->_getMainContext() );
if(mainContext == 0 || !(mainContext->getContextType() == "AGL"))
{
mAGLContext = aglCreateContext(mAGLPixelFormat, NULL);
}
else
{
OSXCarbonContext* context = static_cast<OSXCarbonContext*>( rs->_getMainContext() );
mAGLContext = aglCreateContext(mAGLPixelFormat, context->getContext());
}
}
}
示例2: mContext
GLXContext::GLXContext(GLXGLSupport* glsupport, ::GLXFBConfig fbconfig, ::GLXDrawable drawable, ::GLXContext context) :
mDrawable(drawable), mContext(0), mFBConfig(fbconfig), mGLSupport(glsupport), mExternalContext(false)
{
GLRenderSystem *renderSystem = static_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem());
GLXContext* mainContext = static_cast<GLXContext*>(renderSystem->_getMainContext());
::GLXContext shareContext = 0;
if (mainContext)
{
shareContext = mainContext->mContext;
}
if (context)
{
mContext = context;
mExternalContext = true;
}
else
{
mContext = mGLSupport->createNewContext(mFBConfig, GLX_RGBA_TYPE, shareContext, GL_TRUE);
}
if (! mContext)
{
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Unable to create a suitable GLXContext", "GLXContext::GLXContext");
}
}
示例3: createAGLContext
void OSXCarbonWindow::createAGLContext(size_t fsaa_samples, int depth)
{
if(!mAGLContext)
{
int i = 0;
GLint attribs[ 20 ];
attribs[ i++ ] = AGL_NO_RECOVERY;
attribs[ i++ ] = GL_TRUE;
attribs[ i++ ] = AGL_ACCELERATED;
attribs[ i++ ] = GL_TRUE;
attribs[ i++ ] = AGL_RGBA;
attribs[ i++ ] = AGL_DOUBLEBUFFER;
attribs[ i++ ] = AGL_ALPHA_SIZE;
attribs[ i++ ] = 8;
attribs[ i++ ] = AGL_STENCIL_SIZE;
attribs[ i++ ] = 8;
attribs[ i++ ] = AGL_DEPTH_SIZE;
attribs[ i++ ] = depth;
if(fsaa_samples > 1)
{
attribs[ i++ ] = AGL_MULTISAMPLE;
attribs[ i++ ] = 1;
attribs[ i++ ] = AGL_SAMPLE_BUFFERS_ARB;
attribs[ i++ ] = fsaa_samples;
}
attribs[ i++ ] = AGL_NONE;
mAGLPixelFormat = aglChoosePixelFormat( NULL, 0, attribs );
// Create the AGLContext from our pixel format
// Share it with main
GLRenderSystem *rs = static_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem());
OSXContext* mainContext = static_cast<OSXContext*>( rs->_getMainContext() );
if(mainContext == 0 || !(mainContext->getContextType() == "AGL"))
{
mAGLContext = aglCreateContext(mAGLPixelFormat, NULL);
}
else
{
OSXCarbonContext* context = static_cast<OSXCarbonContext*>( rs->_getMainContext() );
mAGLContext = aglCreateContext(mAGLPixelFormat, context->getContext());
}
}
}
示例4: create
//-------------------------------------------------------------------------------------------------//
void OSXCarbonWindow::create( const String& name, unsigned int width, unsigned int height,
bool fullScreen, const NameValuePairList *miscParams )
{
bool hasDepthBuffer;
String title = name;
size_t fsaa_samples = 0;
int left = 0;
int top = 0;
int depth = 32;
if( miscParams )
{
NameValuePairList::const_iterator opt = NULL;
// Full screen anti aliasing
opt = miscParams->find( "FSAA" );
if( opt != miscParams->end() )
fsaa_samples = StringConverter::parseUnsignedInt( opt->second );
opt = miscParams->find( "left" );
if( opt != miscParams->end() )
left = StringConverter::parseUnsignedInt( opt->second );
opt = miscParams->find( "top" );
if( opt != miscParams->end() )
top = StringConverter::parseUnsignedInt( opt->second );
opt = miscParams->find( "title" );
if( opt != miscParams->end() )
title = opt->second;
opt = miscParams->find( "depthBuffer" );
if( opt != miscParams->end() )
hasDepthBuffer = StringConverter::parseBool( opt->second );
opt = miscParams->find( "colourDepth" );
if( opt != miscParams->end() )
depth = StringConverter::parseUnsignedInt( opt->second );
}
if(fullScreen)
{
GLRenderSystem *rs = static_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem());
OSXContext *mainContext = (OSXContext*)rs->_getMainContext();
CGLContextObj share = NULL;
if(mainContext == 0)
{
share = NULL;
}
else if(mainContext->getContextType() == "AGL")
{
OSXCarbonContext* aglShare = static_cast<OSXCarbonContext*>(mainContext);
aglGetCGLContext(aglShare->getContext(), &((void*)share));
}
else if(mainContext->getContextType() == "CGL")
{
OSXCGLContext* cglShare = static_cast<OSXCGLContext*>(mainContext);
share = cglShare->getContext();
}
// create the context
createCGLFullscreen(width, height, depth, fsaa_samples, share);
}
else
{
int i = 0;
AGLPixelFormat pixelFormat;
GLint attribs[ 20 ];
attribs[ i++ ] = AGL_NO_RECOVERY;
attribs[ i++ ] = GL_TRUE;
attribs[ i++ ] = AGL_ACCELERATED;
attribs[ i++ ] = GL_TRUE;
attribs[ i++ ] = AGL_RGBA;
attribs[ i++ ] = AGL_DOUBLEBUFFER;
attribs[ i++ ] = AGL_ALPHA_SIZE;
attribs[ i++ ] = 8;
attribs[ i++ ] = AGL_STENCIL_SIZE;
attribs[ i++ ] = 8;
attribs[ i++ ] = AGL_DEPTH_SIZE;
attribs[ i++ ] = depth;
if(fsaa_samples > 1)
{
attribs[ i++ ] = AGL_MULTISAMPLE;
attribs[ i++ ] = 1;
attribs[ i++ ] = AGL_SAMPLE_BUFFERS_ARB;
attribs[ i++ ] = fsaa_samples;
}
attribs[ i++ ] = AGL_NONE;
pixelFormat = aglChoosePixelFormat( NULL, 0, attribs );
// Create the AGLContext from our pixel format
// Share it with main
GLRenderSystem *rs = static_cast<GLRenderSystem*>(Root::getSingleton().getRenderSystem());
//.........这里部分代码省略.........