示例#1
0
IFXRESULT CIFXOpenGLOS::LoadOSGL()
{
  IFXRESULT rc = LoadOpenGL();

  if (IFXSUCCESS(rc))
  {
    aglCreateContext =       (AGLCreateContext)GetOpenGLFunc("aglCreateContext");
    aglUpdateContext =       (AGLUpdateContext)GetOpenGLFunc("aglUpdateContext");
    aglGetCurrentContext =   (AGLGetCurrentContext)GetOpenGLFunc("aglGetCurrentContext");
    aglGetDrawable =     (AGLGetDrawable)GetOpenGLFunc("aglGetDrawable");
    aglCopyContext =     (AGLCopyContext)GetOpenGLFunc("aglCopyContext");
    aglDestroyContext =      (AGLDestroyContext)GetOpenGLFunc("aglDestroyContext");
    aglSetCurrentContext =   (AGLSetCurrentContext)GetOpenGLFunc("aglSetCurrentContext");
    aglSetDrawable =     (AGLSetDrawable)GetOpenGLFunc("aglSetDrawable");
    aglSetInteger =      (AGLSetInteger)GetOpenGLFunc("aglSetInteger");
    aglChoosePixelFormat =   (AGLChoosePixelFormat)GetOpenGLFunc("aglChoosePixelFormat");
    aglDestroyPixelFormat =  (AGLDestroyPixelFormat)GetOpenGLFunc("aglDestroyPixelFormat");
    aglSetOffScreen =        (AGLSetOffScreen)GetOpenGLFunc("aglSetOffScreen");
    aglEnable =        (AGLEnable)GetOpenGLFunc("aglEnable");
    aglDisable =       (AGLDisable)GetOpenGLFunc("aglDisable");
    aglDescribePixelFormat = (AGLDescribePixelFormat)GetOpenGLFunc("aglDescribePixelFormat");
    aglQueryRendererInfo =   (AGLQueryRendererInfo)GetOpenGLFunc("aglQueryRendererInfo");
    aglDestroyRendererInfo = (AGLDestroyRendererInfo)GetOpenGLFunc("aglDestroyRendererInfo");
    aglNextRendererInfo =    (AGLNextRendererInfo)GetOpenGLFunc("aglNextRendererInfo");
    aglDescribeRenderer =    (AGLDescribeRenderer)GetOpenGLFunc("aglDescribeRenderer");
    aglSwapBuffers =     (AGLSwapBuffers)GetOpenGLFunc("aglSwapBuffers");

    if(0 == aglCreateContext)
    {
      rc = IFX_E_UNSUPPORTED;
    }
  }

  return rc;
}
示例#2
0
文件: glsup.c 项目: Gaikokujin/WinNT4
// __glDrvDescribePixelFormat
//   This is the first gl related routine that GDI calls. If we get here
//   it means that we need to load the gl driver.
//
// Synopsis:
//   LONG __glDrvDescribePixelFormat (DHPDEV dhpdev,
//                                    LONG iPixelFormat,
//                                    ULONG cjpfd,
//                                    PIXELFORMATDESCRIPTOR *ppfd)
LONG __glDrvDescribePixelFormat (DHPDEV dhpdev,
                                 LONG iPixelFormat,
                                 ULONG cjpfd,
                                 PIXELFORMATDESCRIPTOR *ppfd)
{
    BOOL bRet;
    PPDEV ppdev = (PPDEV)dhpdev;

    // Attempt to load the OpenGL driver
    bRet = LoadOpenGL(ppdev);

    if (bRet)
    {
    	// Success. So call driver's DescribePixelFormat routine
    	return ppdev->pDrvDescribePixelFormat((DHPDEV)ppdev,iPixelFormat,cjpfd,ppfd);
    }

    return 0;
}
示例#3
0
void GLimp_Init( void )
{
//    qboolean success = qfalse;
	char  buf[1024];
	cvar_t *lastValidRenderer = ri.Cvar_Get( "r_lastValidRenderer", "(uninitialized)", CVAR_ARCHIVE );

	r_allowSoftwareGL = ri.Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );

	r_previousglDriver = ri.Cvar_Get( "r_previousglDriver", "", CVAR_ROM );

//	InitSig();

	// Hack here so that if the UI 
	if ( *r_previousglDriver->string )
	{
		// The UI changed it on us, hack it back
		// This means the renderer can't be changed on the fly
		ri.Cvar_Set( "r_glDriver", r_previousglDriver->string );
	}
	
	//
	// load and initialize the specific OpenGL driver
	//
	if ( !LoadOpenGL( r_glDriver->string ) ) {
		return;
	}

	// Save it in case the UI stomps it
	ri.Cvar_Set( "r_previousglDriver", r_glDriver->string );

	// This values force the UI to disable driver selection
	glConfig.driverType = GLDRV_ICD;
	glConfig.hardwareType = GLHW_GENERIC;

	// get our config strings
	Q_strncpyz( glConfig.vendor_string, qglGetString (GL_VENDOR), sizeof( glConfig.vendor_string ) );
	Q_strncpyz( glConfig.renderer_string, qglGetString (GL_RENDERER), sizeof( glConfig.renderer_string ) );
	if (*glConfig.renderer_string && glConfig.renderer_string[strlen(glConfig.renderer_string) - 1] == '\n')
		glConfig.renderer_string[strlen(glConfig.renderer_string) - 1] = 0;
	Q_strncpyz( glConfig.version_string, qglGetString (GL_VERSION), sizeof( glConfig.version_string ) );
	Q_strncpyz( glConfig.extensions_string, qglGetString (GL_EXTENSIONS), sizeof( glConfig.extensions_string ) );

	//
	// chipset specific configuration
	//
	strcpy( buf, glConfig.renderer_string );
	strlwr( buf );

	//
	// NOTE: if changing cvars, do it within this block.  This allows them
	// to be overridden when testing driver fixes, etc. but only sets
	// them to their default state when the hardware is first installed/run.
	//
	if ( Q_stricmp( lastValidRenderer->string, glConfig.renderer_string ) )
	{
		glConfig.hardwareType = GLHW_GENERIC;

		ri.Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST" );

		// VOODOO GRAPHICS w/ 2MB
		if ( Q_stristr( buf, "voodoo graphics/1 tmu/2 mb" ) )
		{
			ri.Cvar_Set( "r_picmip", "2" );
			ri.Cvar_Get( "r_picmip", "1", CVAR_ARCHIVE | CVAR_LATCH );
		} else
		{
			ri.Cvar_Set( "r_picmip", "1" );

			if ( Q_stristr( buf, "rage 128" ) || Q_stristr( buf, "rage128" ) )
			{
				ri.Cvar_Set( "r_finish", "0" );
			}
			// Savage3D and Savage4 should always have trilinear enabled
			else if ( Q_stristr( buf, "savage3d" ) || Q_stristr( buf, "s3 savage4" ) )
			{
				ri.Cvar_Set( "r_texturemode", "GL_LINEAR_MIPMAP_LINEAR" );
			}
		}
	}

	//
	// this is where hardware specific workarounds that should be
	// detected/initialized every startup should go.
	//
	if ( Q_stristr( buf, "banshee" ) || Q_stristr( buf, "Voodoo_Graphics" ) )
	{
		glConfig.hardwareType = GLHW_3DFX_2D3D;
	} else if ( Q_stristr( buf, "rage pro" ) || Q_stristr( buf, "RagePro" ) )
	{
		glConfig.hardwareType = GLHW_RAGEPRO;
	} else if ( Q_stristr( buf, "permedia2" ) )
	{
		glConfig.hardwareType = GLHW_PERMEDIA2;
	} else if ( Q_stristr( buf, "riva 128" ) )
	{
		glConfig.hardwareType = GLHW_RIVA128;
	} else if ( Q_stristr( buf, "riva tnt " ) )
	{
	}

	ri.Cvar_Set( "r_lastValidRenderer", glConfig.renderer_string );

	// initialize extensions
	//GLW_InitExtensions();
	//GLW_InitGamma();

//	InitSig(); // not clear why this is at begin & end of function

	return;
}