本文整理汇总了C++中GLContext::logConfig方法的典型用法代码示例。如果您正苦于以下问题:C++ GLContext::logConfig方法的具体用法?C++ GLContext::logConfig怎么用?C++ GLContext::logConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLContext
的用法示例。
在下文中一共展示了GLContext::logConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exception
SDLWindow::SDLWindow(const DisplayParams& dp, GLConfig glConfig)
: Window(dp.getWindowParams(0), dp.isFullscreen()),
m_pLastMouseEvent(new MouseEvent(Event::CURSOR_MOTION, false, false, false,
IntPoint(-1, -1), MouseEvent::NO_BUTTON, glm::vec2(-1, -1), 0))
{
initTranslationTable();
// This "fixes" the default behaviour of SDL under x11, avoiding it
// to report relative mouse coordinates when going fullscreen and
// the mouse cursor is hidden (grabbed). So far libavg and apps based
// on it don't use relative coordinates.
setEnv("SDL_MOUSE_RELATIVE", "0");
const WindowParams& wp = dp.getWindowParams(0);
stringstream ss;
IntPoint pos = getPos();
if (pos.x != -1) {
ss << pos.x << "," << pos.y;
setEnv("SDL_VIDEO_WINDOW_POS", ss.str().c_str());
}
unsigned int flags = 0;
if (dp.isFullscreen()) {
flags |= SDL_FULLSCREEN;
}
if (!wp.m_bHasWindowFrame) {
flags |= SDL_NOFRAME;
}
IntPoint size = wp.m_Size;
SDL_Surface * pSDLSurface = 0;
#ifndef linux
if (glConfig.m_bUseDebugContext) {
glConfig.m_bUseDebugContext = false;
}
switch (dp.getBPP()) {
case 24:
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 24);
break;
case 16:
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16);
break;
default:
AVG_LOG_ERROR("Unsupported bpp " << dp.getBPP() <<
"in Window::init()");
exit(-1);
}
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL , 0);
flags |= SDL_OPENGL;
while (glConfig.m_MultiSampleSamples && !pSDLSurface) {
if (glConfig.m_MultiSampleSamples > 1) {
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES,
glConfig.m_MultiSampleSamples);
} else {
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
}
pSDLSurface = SDL_SetVideoMode(size.x, size.y, dp.getBPP(), flags);
if (!pSDLSurface) {
glConfig.m_MultiSampleSamples = GLContext::nextMultiSampleValue(
glConfig.m_MultiSampleSamples);
}
}
#else
// Linux version: Context created manually, not by SDL
pSDLSurface = SDL_SetVideoMode(size.x, size.y, dp.getBPP(), flags);
#endif
if (!pSDLSurface) {
throw Exception(AVG_ERR_UNSUPPORTED, string("Setting SDL video mode failed: ")
+ SDL_GetError() + ". (size=" + toString(size) + ", bpp=" +
toString(dp.getBPP()) + ").");
}
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
int rc = SDL_GetWMInfo(&info);
AVG_ASSERT(rc != -1);
GLContext* pGLContext = GLContextManager::get()->createContext(glConfig, size, &info);
setGLContext(pGLContext);
#if defined(HAVE_XI2_1) || defined(HAVE_XI2_2)
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
m_pXIMTInputDevice = 0;
#endif
SDL_WM_SetCaption("libavg", 0);
pGLContext->logConfig();
}