Пример #1
0
/*
** GLimp_SetMode
*/
rserr_t GLimp_SetMode( int x, int y, int width, int height, int displayFrequency, bool fullscreen, bool stereo, bool borderless )
{
	const char *win_fs[] = { "W", "FS" };

	ri.Com_Printf( "Setting video mode:" );

	// disable fullscreen if rendering to a parent window
	if( glw_state.parenthWnd ) {
		RECT parentWindowRect;

		fullscreen = false;

		GetWindowRect( glw_state.parenthWnd, &parentWindowRect );
		width = parentWindowRect.right - parentWindowRect.left;
		height = parentWindowRect.bottom - parentWindowRect.top;
	}

	ri.Com_Printf( " %d %d %s\n", width, height, win_fs[fullscreen] );

	// destroy the existing window
	if( glw_state.hWnd )
	{
		GLimp_Shutdown();
	}

	glw_state.win_x = x;
	glw_state.win_y = y;

	glConfig.width = width;
	glConfig.height = height;
	glConfig.fullScreen = ( fullscreen ? GLimp_SetFullscreenMode( displayFrequency, fullscreen ) == rserr_ok : false );
	glConfig.stereoEnabled = stereo;
	glConfig.borderless = borderless;

	GLimp_CreateWindow();

	// init all the gl stuff for the window
	if( !GLimp_InitGL() ) {
		ri.Com_Printf( "GLimp_CreateWindow() - GLimp_InitGL failed\n" );
		return false;
	}

	return ( fullscreen == glConfig.fullScreen ? rserr_ok : rserr_invalid_fullscreen );
}
Пример #2
0
/**
 * Set video mode.
 * @param mode number of the mode to set
 * @param fullscreen <code>true</code> for a fullscreen mode,
 *     <code>false</code> otherwise
 */
rserr_t GLimp_SetMode( int x, int y, int width, int height, int displayFrequency, bool fullscreen, bool stereo, bool borderless )
{
	const char *win_fs[] = {"W", "FS"};

#ifdef __APLE__
	if( fullscreen ) {
		borderless = true;
	}
	else {
		borderless = false;
	}
#endif

	ri.Com_Printf( "Initializing OpenGL display\n" );
	ri.Com_Printf( "...setting mode:" );
	ri.Com_Printf( " %d %d %s\n", width, height, win_fs[fullscreen] );

	// destroy the existing window
	if( glw_state.sdl_window ) {
		GLimp_Shutdown();
	}

	GLimp_CreateWindow( x, y, width, height );

	// init all the gl stuff for the window
	if( !GLimp_InitGL( r_stencilbits->integer, stereo ) ) {
		ri.Com_Printf( "VID_CreateWindow() - GLimp_InitGL failed\n" );
		return rserr_invalid_mode;
	}

	glConfig.width = width;
	glConfig.height = height;
	glConfig.borderless = borderless;
	glConfig.fullScreen = fullscreen;
	if( GLimp_SetFullscreenMode( displayFrequency, fullscreen ) == rserr_ok ) {
		glConfig.fullScreen = fullscreen;
	}
	else {
		glConfig.fullScreen = !fullscreen;
	}

    return glConfig.fullScreen == fullscreen ? rserr_ok : rserr_invalid_fullscreen;
}
Пример #3
0
/**
 * Set video mode.
 * @param mode number of the mode to set
 * @param fullscreen <code>true</code> for a fullscreen mode,
 *     <code>false</code> otherwise
 */
rserr_t GLimp_SetMode( int x, int y, int width, int height, int displayFrequency, bool fullscreen, bool stereo )
{
	const char *win_fs[] = {"W", "FS"};

	if( width == glConfig.width && height == glConfig.height && glConfig.fullScreen != fullscreen ) {
		if( GLimp_SetWindowFullscreen( fullscreen ) ) {
			glConfig.fullScreen = fullscreen;
			return rserr_ok;
		}
		return rserr_restart_required;
	}

	ri.Com_Printf( "Initializing OpenGL display\n" );
	ri.Com_Printf( "...setting mode:" );
	ri.Com_Printf( " %d %d %s\n", width, height, win_fs[fullscreen] );

	// destroy the existing window
	if( glw_state.sdl_window ) {
		GLimp_Shutdown();
	}

	GLimp_CreateWindow( x, y, width, height );

	// init all the gl stuff for the window
	if( !GLimp_InitGL( r_stencilbits->integer, stereo ) ) {
		ri.Com_Printf( "VID_CreateWindow() - GLimp_InitGL failed\n" );
		return rserr_invalid_mode;
	}

	if( fullscreen && !GLimp_SetWindowFullscreen( fullscreen ) ) {
		return rserr_invalid_fullscreen;
	}

	glConfig.width = width;
	glConfig.height = height;
	glConfig.fullScreen = fullscreen;
	return rserr_ok;
}