本文整理汇总了C++中GLContext::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ GLContext::begin方法的具体用法?C++ GLContext::begin怎么用?C++ GLContext::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLContext
的用法示例。
在下文中一共展示了GLContext::begin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initOpenGL
void GLGraphicsImpl::initOpenGL( GLContext& context ) {
//Is this the first time we've called this function?
//If m_initialized is "false", set it to "true" and continue.
//Otherwise, stop here.
bool expect = false;
if( !m_initialized.compare_exchange_strong( expect, true ) )
return;
//Activate our context temporarily
context.begin();
//Now that a context is loaded we can load extensions
loadOpenGLExtensions();
//Get the version of OpenGL we're using and log it
GLint major, minor;
glGetIntegerv( GL_MAJOR_VERSION, &major );
glGetIntegerv( GL_MINOR_VERSION, &minor );
logInfo( ( boost::format( "OpenGL version is %d.%d." ) % major % minor ).str() );
//Log supported extensions
GLint extensions;
glGetIntegerv( GL_NUM_EXTENSIONS, &extensions );
logInfo( "Supported extensions:" );
for( GLuint i = 0; i < (GLuint)extensions; ++i )
logInfo( (
boost::format( "%4d: %s" ) %
(i+1) %
glGetStringi( GL_EXTENSIONS, i )
).str() );
//Done using it
context.end();
}