bool OGLVideoMupenPlus::_start() { CoreVideo_Init(); _setAttributes(); m_bFullscreen = config.video.fullscreen > 0; m_screenWidth = config.video.windowedWidth; m_screenHeight = config.video.windowedHeight; _setBufferSize(); printf("(II) Setting video mode %dx%d...\n", m_screenWidth, m_screenHeight); const m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING; if (CoreVideo_SetVideoMode(m_screenWidth, m_screenHeight, 0, m_bFullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, flags) != M64ERR_SUCCESS) { //printf("(EE) Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight); LOG(LOG_ERROR, "[gles2GlideN64]: Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight); CoreVideo_Quit(); return false; } LOG(LOG_VERBOSE, "[gles2GlideN64]: Create setting videomode %dx%d\n", m_screenWidth, m_screenHeight); char caption[128]; # ifdef _DEBUG sprintf(caption, "%s debug. Revision %s", pluginName, PLUGIN_REVISION); # else // _DEBUG sprintf(caption, "%s. Revision %s", pluginName, PLUGIN_REVISION); # endif // _DEBUG CoreVideo_SetCaption(caption); return true; }
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; }
//----------------------------------------------------------------------------- // Dispose //----------------------------------------------------------------------------- void GraphicsPlugin::dispose() { //Dispose of Textures m_textureCache.dispose(); //Dispose of member objects if ( m_vi ) { delete m_vi; m_vi = 0; } if ( m_memory ) { delete m_memory; m_memory = 0; } if ( m_displayListParser ) { delete m_displayListParser; m_displayListParser = 0; } if ( m_fogManager ) { delete m_fogManager; m_fogManager = 0; } m_gbi.dispose(); m_rdp.dispose(); m_rsp.dispose(); //Dispose of OpenGL //framebuffer01.dispose(); // framebuffer02.dispose(); m_openGLMgr.dispose(); if (m_initialized) CoreVideo_Quit(); m_initialized = false; }
//----------------------------------------------------------------------------- // Dispose //----------------------------------------------------------------------------- void GraphicsPlugin::dispose() { //Dispose of Textures m_textureCache.dispose(); //Dispose of member objects if ( m_vi ) { delete m_vi; m_vi = 0; } if ( m_memory ) { delete m_memory; m_memory = 0; } if ( m_displayListParser ) { delete m_displayListParser; m_displayListParser = 0; } if ( m_fogManager ) { delete m_fogManager; m_fogManager = 0; } m_gbi.dispose(); m_rdp.dispose(); m_rsp.dispose(); //Dispose of OpenGL //framebuffer01.dispose(); // framebuffer02.dispose(); m_openGLMgr.dispose(); if (m_initialized) #ifdef HAVE_GLES { EGL_Close(); SDL_Quit(); // *SEB* *TODO* Close Subsystem only? } #else CoreVideo_Quit(); #endif m_initialized = false; }
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; }
bool OGLVideoMupenPlus::_start() { CoreVideo_Init(); _setAttributes(); m_bFullscreen = config.video.fullscreen > 0; m_screenWidth = config.video.windowedWidth; m_screenHeight = config.video.windowedHeight; _getDisplaySize(); _setBufferSize(); printf("(II) Setting video mode %dx%d...\n", m_screenWidth, m_screenHeight); const m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING; if (CoreVideo_SetVideoMode(m_screenWidth, m_screenHeight, 0, m_bFullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, flags) != M64ERR_SUCCESS) { //printf("(EE) Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight); LOG(LOG_ERROR, "[gles2GlideN64]: Error setting videomode %dx%d\n", m_screenWidth, m_screenHeight); CoreVideo_Quit(); return false; } LOG(LOG_VERBOSE, "[gles2GlideN64]: Create setting videomode %dx%d\n", m_screenWidth, m_screenHeight); return true; }
void OGLVideoMupenPlus::_stop() { CoreVideo_Quit(); }
void DisplayWindowMupen64plus::_stop() { CoreVideo_Quit(); }
bool COGLGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed ) { DebugMessage(M64MSG_INFO, "Initializing OpenGL Device Context."); Lock(); CGraphicsContext::Initialize(dwWidth, dwHeight, bWindowed ); if( bWindowed ) { windowSetting.statusBarHeightToUse = windowSetting.statusBarHeight; windowSetting.toolbarHeightToUse = windowSetting.toolbarHeight; } else { windowSetting.statusBarHeightToUse = 0; windowSetting.toolbarHeightToUse = 0; } int depthBufferDepth = options.OpenglDepthBufferSetting; int colorBufferDepth = 32; int bVerticalSync = windowSetting.bVerticalSync; if( options.colorQuality == TEXTURE_FMT_A4R4G4B4 ) colorBufferDepth = 16; // init sdl & gl DebugMessage(M64MSG_VERBOSE, "Initializing video subsystem..."); if (CoreVideo_Init() != M64ERR_SUCCESS) return false; /* hard-coded attribute values */ const int iDOUBLEBUFFER = 1; // OpenEmu #if 0 /* 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); #endif /* 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); } /* Set the video mode */ m64p_video_mode ScreenMode = bWindowed ? M64VIDEO_WINDOWED : M64VIDEO_FULLSCREEN; m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING; if (CoreVideo_SetVideoMode(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, colorBufferDepth, ScreenMode, flags) != 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; } // OpenEmu #if 0 /* check that our opengl attributes were properly set */ int iActual; if (CoreVideo_GL_GetAttribute(M64P_GL_DOUBLEBUFFER, &iActual) == M64ERR_SUCCESS) if (iActual != iDOUBLEBUFFER) DebugMessage(M64MSG_WARNING, "Failed to set GL_DOUBLEBUFFER to %i. (it's %i)", iDOUBLEBUFFER, iActual); if (CoreVideo_GL_GetAttribute(M64P_GL_SWAP_CONTROL, &iActual) == M64ERR_SUCCESS) if (iActual != bVerticalSync) DebugMessage(M64MSG_WARNING, "Failed to set GL_SWAP_CONTROL to %i. (it's %i)", bVerticalSync, iActual); if (CoreVideo_GL_GetAttribute(M64P_GL_BUFFER_SIZE, &iActual) == M64ERR_SUCCESS) if (iActual != colorBufferDepth) DebugMessage(M64MSG_WARNING, "Failed to set GL_BUFFER_SIZE to %i. (it's %i)", colorBufferDepth, iActual); if (CoreVideo_GL_GetAttribute(M64P_GL_DEPTH_SIZE, &iActual) == M64ERR_SUCCESS) if (iActual != depthBufferDepth) DebugMessage(M64MSG_WARNING, "Failed to set GL_DEPTH_SIZE to %i. (it's %i)", depthBufferDepth, iActual); #endif #ifndef USE_GLES /* Get function pointers to OpenGL extensions (blame Microsoft Windows for this) */ OGLExtensions_Init(); #endif char caption[500]; sprintf(caption, "%s v%i.%i.%i", PLUGIN_NAME, VERSION_PRINTF_SPLIT(PLUGIN_VERSION)); CoreVideo_SetCaption(caption); SetWindowMode(); InitState(); InitOGLExtension(); sprintf(m_strDeviceStats, "%.60s - %.128s : %.60s", m_pVendorStr, m_pRenderStr, m_pVersionStr); TRACE0(m_strDeviceStats); DebugMessage(M64MSG_INFO, "Using OpenGL: %s", m_strDeviceStats); Unlock(); Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); // Clear buffers UpdateFrame(); Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); UpdateFrame(); m_bReady = true; return true; }
void COGLGraphicsContext::CleanUp() { CoreVideo_Quit(); m_bReady = false; }
bool COGLGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed ) { DebugMessage(M64MSG_INFO, "Initializing OpenGL Device Context."); Lock(); CGraphicsContext::Get()->m_supportTextureMirror = false; CGraphicsContext::Initialize(dwWidth, dwHeight, bWindowed ); if( bWindowed ) { windowSetting.statusBarHeightToUse = windowSetting.statusBarHeight; windowSetting.toolbarHeightToUse = windowSetting.toolbarHeight; } else { windowSetting.statusBarHeightToUse = 0; windowSetting.toolbarHeightToUse = 0; } int depthBufferDepth = options.OpenglDepthBufferSetting; int colorBufferDepth = 32; if( options.colorQuality == TEXTURE_FMT_A4R4G4B4 ) colorBufferDepth = 16; // init sdl & gl DebugMessage(M64MSG_VERBOSE, "Initializing video subsystem..."); if (CoreVideo_Init() != M64ERR_SUCCESS) return false; /* set opengl attributes */ CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, 1); CoreVideo_GL_SetAttribute(M64P_GL_BUFFER_SIZE, colorBufferDepth); CoreVideo_GL_SetAttribute(M64P_GL_DEPTH_SIZE, depthBufferDepth); /* Set the video mode */ m64p_video_mode ScreenMode = bWindowed ? M64VIDEO_WINDOWED : M64VIDEO_FULLSCREEN; if (CoreVideo_SetVideoMode(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, colorBufferDepth, ScreenMode) != 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; } char caption[500]; sprintf(caption, "%s v%i.%i.%i", PLUGIN_NAME, VERSION_PRINTF_SPLIT(PLUGIN_VERSION)); CoreVideo_SetCaption(caption); SetWindowMode(); InitState(); InitOGLExtension(); sprintf(m_strDeviceStats, "%s - %s : %s", m_pVendorStr, m_pRenderStr, m_pVersionStr); TRACE0(m_strDeviceStats); DebugMessage(M64MSG_INFO, "Using OpenGL: %s", m_strDeviceStats); Unlock(); Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); // Clear buffers UpdateFrame(); Clear(CLEAR_COLOR_AND_DEPTH_BUFFER); UpdateFrame(); m_bReady = true; status.isVertexShaderEnabled = false; return true; }