bool DisplayWindowMupen64plus::_resizeWindow() { _setAttributes(); m_bFullscreen = false; m_width = m_screenWidth = m_resizeWidth; m_height = m_screenHeight = m_resizeHeight; switch (CoreVideo_ResizeWindow(m_screenWidth, m_screenHeight)) { case M64ERR_INVALID_STATE: printf("(EE) Error setting videomode %dx%d in fullscreen mode\n", m_screenWidth, m_screenHeight); m_width = m_screenWidth = config.video.windowedWidth; m_height = m_screenHeight = config.video.windowedHeight; break; case M64ERR_SUCCESS: break; default: printf("(EE) Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight); m_width = m_screenWidth = config.video.windowedWidth; m_height = m_screenHeight = config.video.windowedHeight; CoreVideo_Quit(); return false; } _setBufferSize(); opengl::Utils::isGLError(); // reset GL error. return true; }
bool COGLGraphicsContext::ResizeInitialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed ) { Lock(); CGraphicsContext::Initialize(dwWidth, dwHeight, bWindowed ); int depthBufferDepth = options.OpenglDepthBufferSetting; int colorBufferDepth = 32; int bVerticalSync = windowSetting.bVerticalSync; if( options.colorQuality == TEXTURE_FMT_A4R4G4B4 ) colorBufferDepth = 16; /* hard-coded attribute values */ const int iDOUBLEBUFFER = 1; /* set opengl attributes */ CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, iDOUBLEBUFFER); CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL, bVerticalSync); CoreVideo_GL_SetAttribute(M64P_GL_BUFFER_SIZE, colorBufferDepth); CoreVideo_GL_SetAttribute(M64P_GL_DEPTH_SIZE, depthBufferDepth); /* set multisampling */ if (options.multiSampling > 0) { CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLEBUFFERS, 1); if (options.multiSampling <= 2) CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 2); else if (options.multiSampling <= 4) CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 4); else if (options.multiSampling <= 8) CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 8); else CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 16); } /* Call Mupen64plus core Video Extension to resize the window, which will create a new OpenGL Context under SDL */ if (CoreVideo_ResizeWindow(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight) != M64ERR_SUCCESS) { DebugMessage(M64MSG_ERROR, "Failed to set %i-bit video mode: %ix%i", colorBufferDepth, (int)windowSetting.uDisplayWidth, (int)windowSetting.uDisplayHeight); CoreVideo_Quit(); return false; } InitState(); Unlock(); Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); // Clear buffers UpdateFrame(); Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); UpdateFrame(); return true; }
bool OGLVideoMupenPlus::_resizeWindow() { _setAttributes(); m_bFullscreen = false; m_width = m_screenWidth = m_resizeWidth; m_height = m_screenHeight = m_resizeHeight; if (CoreVideo_ResizeWindow(m_screenWidth, m_screenHeight) != M64ERR_SUCCESS) { printf("(EE) Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight); m_width = m_screenWidth = config.video.windowedWidth; m_height = m_screenHeight = config.video.windowedHeight; CoreVideo_Quit(); return false; } _setBufferSize(); isGLError(); // reset GL error. return true; }