/* ** InitOpenGL ** ** This function is responsible for initializing a valid OpenGL subsystem. This ** is done by calling GLimp_Init (which gives us a working OGL subsystem) then ** setting variables, checking GL constants, and reporting the gfx system config ** to the user. */ static void InitOpenGL( void ) { // // initialize OS specific portions of the renderer // // GLimp_Init directly or indirectly references the following cvars: // - r_fullscreen // - r_mode // - r_(color|depth|stencil)bits // - r_ignorehwgamma // - r_gamma // if ( glConfig.vidWidth == 0 ) { GLimp_Init(); // print info the first time only GL_SetDefaultState(); R_Splash(); //get something on screen asap GfxInfo_f(); } else { // set default state GL_SetDefaultState(); } // init command buffers and SMP R_InitCommandBuffers(); }
/* ** InitOpenGL ** ** This function is responsible for initializing a valid OpenGL subsystem. This ** is done by calling GLimp_Init (which gives us a working OGL subsystem) then ** setting variables, checking GL constants, and reporting the gfx system config ** to the user. */ static void InitOpenGL( void ) { char renderer_buffer[1024]; // // initialize OS specific portions of the renderer // // GLimp_Init directly or indirectly references the following cvars: // - r_fullscreen // - r_mode // - r_(color|depth|stencil)bits // - r_ignorehwgamma // - r_gamma // if ( glConfig.vidWidth == 0 ) { GLint temp; GLimp_Init(); strcpy( renderer_buffer, glConfig.renderer_string ); Q_strlwr( renderer_buffer ); // OpenGL driver constants qglGetIntegerv( GL_MAX_TEXTURE_SIZE, &temp ); glConfig.maxTextureSize = temp; // stubbed or broken drivers may have reported 0... if ( glConfig.maxTextureSize <= 0 ) { glConfig.maxTextureSize = 0; } } // set default state GL_SetDefaultState(); }
/* ============================ idAutoRender::RenderFrame ============================ */ void idAutoRender::RenderFrame() { // values are 0 to 1 float loadingIconPosX = 0.5f; float loadingIconPosY = 0.6f; float loadingIconScale = 0.025f; float loadingIconSpeed = 0.095f; if( autoRenderIcon == AUTORENDER_HELLICON ) { loadingIconPosX = 0.85f; loadingIconPosY = 0.85f; loadingIconScale = 0.1f; loadingIconSpeed = 0.095f; } else if( autoRenderIcon == AUTORENDER_DIALOGICON ) { loadingIconPosY = 0.73f; } GL_SetDefaultState(); GL_Cull( CT_TWO_SIDED ); const bool stereoRender = false; const int width = renderSystem->GetWidth(); const int height = renderSystem->GetHeight(); const int guardBand = height / 24; if( stereoRender ) { for( int viewNum = 0 ; viewNum < 2; viewNum++ ) { GL_ViewportAndScissor( 0, viewNum * ( height + guardBand ), width, height ); RenderBackground(); RenderLoadingIcon( loadingIconPosX, loadingIconPosY, loadingIconScale, loadingIconSpeed ); } } else { GL_ViewportAndScissor( 0, 0, width, height ); RenderBackground(); RenderLoadingIcon( loadingIconPosX, loadingIconPosY, loadingIconScale, loadingIconSpeed ); } }
/* ** InitOpenGL ** ** This function is responsible for initializing a valid OpenGL subsystem. This ** is done by calling GLimp_Init (which gives us a working OGL subsystem) then ** setting variables, checking GL constants, and reporting the gfx system config ** to the user. */ static void InitOpenGL( void ) { char renderer_buffer[1024]; // // initialize OS specific portions of the renderer // // GLimp_Init directly or indirectly references the following cvars: // - r_fullscreen // - r_glDriver // - r_mode // - r_(color|depth|stencil)bits // - r_ignorehwgamma // - r_gamma // if ( !glState.initialized ) // @pjb: vdConfig.vidWidth == 0 is no longer a good indicator { GLint temp; GLimp_Init(); strcpy( renderer_buffer, vdConfig.renderer_string ); Q_strlwr( renderer_buffer ); // OpenGL driver constants qglGetIntegerv( GL_MAX_TEXTURE_SIZE, &temp ); vdConfig.maxTextureSize = temp; // stubbed or broken drivers may have reported 0... if ( vdConfig.maxTextureSize <= 0 ) { vdConfig.maxTextureSize = 0; } glState.initialized = qtrue; } // init command buffers and SMP R_InitCommandBuffers(); // print info GLRB_GfxInfo_f(); // set default state GL_SetDefaultState(); }
void GLRB_RestoreTextureState( void ) { // Flush textures; reset texture state Com_Memset( glState.currenttextures, 0, sizeof( glState.currenttextures ) ); if ( qglBindTexture ) { if ( qglActiveTextureARB ) { GL_SelectTexture( 1 ); qglBindTexture( GL_TEXTURE_2D, 0 ); GL_SelectTexture( 0 ); qglBindTexture( GL_TEXTURE_2D, 0 ); } else { qglBindTexture( GL_TEXTURE_2D, 0 ); } } GL_SetDefaultState(); }
/* ** InitOpenGL ** ** This function is responsible for initializing a valid OpenGL subsystem. This ** is done by calling GLimp_Init (which gives us a working OGL subsystem) then ** setting variables, checking GL constants, and reporting the gfx system config ** to the user. */ static void InitOpenGL(void) { char renderer_buffer[1024]; /* * initialize OS specific portions of the renderer * * GLimp_Init directly or indirectly references the following cvars: * - r_fullscreen * - r_mode * - r_(color|depth|stencil)bits * - r_ignorehwgamma * - r_gamma * */ if(glConfig.vidWidth == 0){ GLint temp; GLimp_Init(); strcpy(renderer_buffer, glConfig.renderer_string); Q_strlwr(renderer_buffer); /* OpenGL driver constants */ qglGetIntegerv(GL_MAX_TEXTURE_SIZE, &temp); glConfig.maxTextureSize = temp; /* stubbed or broken drivers may have reported 0... */ if(glConfig.maxTextureSize <= 0){ glConfig.maxTextureSize = 0; } } /* init command buffers and SMP */ R_InitCommandBuffers(); /* print info */ GfxInfo_f(); /* set default state */ GL_SetDefaultState(); }
/* ----------------------------------------------------------------------------- Function: Parameters: Returns: Notes: ----------------------------------------------------------------------------- */ PUBLIC void R_Init() { char renderer_buffer[ 1000 ]; char vendor_buffer[ 1000 ]; int err; int a, b; Com_Printf( "\n------ Display Initialization ------\n" ); Com_Printf( "Initializing OpenGL Subsystem\n" ); R_Register(); // set our "safe" modes gl_state.prev_mode = 0; // get various GL strings gl_config.vendor_string = (char *)pfglGetString( GL_VENDOR ); Com_Printf( "GL_VENDOR: %s\n", gl_config.vendor_string ); gl_config.renderer_string = (char *)pfglGetString( GL_RENDERER ); Com_Printf( "GL_RENDERER: %s\n", gl_config.renderer_string ); gl_config.version_string = (char *)pfglGetString( GL_VERSION ); Com_Printf( "GL_VERSION: %s\n", gl_config.version_string ); gl_config.extensions_string = (char *)pfglGetString( GL_EXTENSIONS ); Com_Printf( "GL_EXTENSIONS: %s\n", gl_config.extensions_string ); my_strlcpy( renderer_buffer, gl_config.renderer_string, sizeof( renderer_buffer ) ); (void)my_strlwr( renderer_buffer ); my_strlcpy( vendor_buffer, gl_config.vendor_string, sizeof( vendor_buffer ) ); (void)my_strlwr( vendor_buffer ); sscanf( gl_config.version_string, "%d.%d", &a, &b ); if( a >= 1 && b >= 2 ) { gl_config.Version_1_2 = true; } pfglGetIntegerv( GL_MAX_TEXTURE_SIZE, &glMaxTexSize ); Com_Printf( "GL_MAX_TEXTURE_SIZE: %d\n", glMaxTexSize); if ( strstr( gl_config.extensions_string, "GL_EXT_discard_framebuffer" ) != 0 ) { gl_config.framebuffer_discard = true; } else { gl_config.framebuffer_discard = false; } InitImmediateModeGL(); GL_SetDefaultState(); TM_Init(); Font_Init(); err = pfglGetError(); if( err != GL_NO_ERROR ) { Com_Printf( "glGetError() = 0x%x\n", err ); } }