コード例 #1
0
ファイル: win_glimp.c プロジェクト: chegestar/omni-bot
/*
** GLW_GenDefaultLists
*/
static void GLW_GenDefaultLists( void ) {
	HFONT hfont, oldhfont;

	// keep going, we'll probably just leak some stuff
	if ( fontbase_init ) {
		Com_DPrintf( "ERROR: GLW_GenDefaultLists: font base is already marked initialized\n" );
	}

	// create font display lists
	gl_NormalFontBase = qglGenLists( 256 );

	if ( gl_NormalFontBase == 0 ) {
		Com_Printf( "ERROR: couldn't create font (glGenLists)\n" );
		return;
	}

	hfont = CreateFont(
		12, // logical height of font
		6,  // logical average character width
		0,  // angle of escapement
		0,  // base-line orientation angle
		0,  // font weight
		0,  // italic attribute flag
		0,  // underline attribute flag
		0,  // strikeout attribute flag
		0,  // character set identifier
		0,  // output precision
		0,  // clipping precision
		0,  // output quality
		0,  // pitch and family
		"" ); // pointer to typeface name string

	if ( !hfont ) {
		Com_Printf( "ERROR: couldn't create font (CreateFont)\n" );
		return;
	}

	oldhfont = SelectObject( glw_state.hDC, hfont );
	qwglUseFontBitmaps( glw_state.hDC, 0, 255, gl_NormalFontBase );

	SelectObject( glw_state.hDC, oldhfont );
	DeleteObject( hfont );

	fontbase_init = qtrue;
}
コード例 #2
0
ファイル: CamWnd.cpp プロジェクト: AHPlankton/Quake-III-Arena
int CCamWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
  if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	g_qeglobals.d_hdcBase = GetDC()->m_hDC;
	QEW_SetupPixelFormat(g_qeglobals.d_hdcBase, true);

  if ((g_qeglobals.d_hglrcBase = qwglCreateContext(g_qeglobals.d_hdcBase)) == 0)
	  Error("wglCreateContext failed");
  
  if (!qwglMakeCurrent(g_qeglobals.d_hdcBase, g_qeglobals.d_hglrcBase))
	  Error ("wglMakeCurrent failed");


	//
	// create GL font
	//
  HFONT hfont = ::CreateFont(
	  12,	// logical height of font 
		 6,	// logical average character width 
		 0,	// angle of escapement 
		 0,	// base-line orientation angle 
		 0,	// font weight 
		 0,	// italic attribute flag 
		 0,	// underline attribute flag 
		 0,	// strikeout attribute flag 
		 0,	// character set identifier 
		 0,	// output precision 
		 0,	// clipping precision 
		 0,	// output quality 
		 0,	// pitch and family 
		 "system font" // pointer to typeface name string 
		 	);

	if (!hfont)
	  Error( "couldn't create font" );

  ::SelectObject(g_qeglobals.d_hdcBase, hfont);

	if ((g_qeglobals.d_font_list = qglGenLists (256)) == 0)
	  Error( "couldn't create font dlists" );
			
	// create the bitmap display lists
	// we're making images of glyphs 0 thru 255
  
  if (g_PrefsDlg.m_bBuggyICD)
  {
	  if ( !qwglUseFontBitmaps (g_qeglobals.d_hdcBase, 1, 255, g_qeglobals.d_font_list-1) )
	    Error( "wglUseFontBitmaps faileD" );
  }
  else
  {
	  if ( !qwglUseFontBitmaps (g_qeglobals.d_hdcBase, 1, 255, g_qeglobals.d_font_list) )
	    Error( "wglUseFontBitmaps faileD" );
  }
	
	// indicate start of glyph display lists
	qglListBase (g_qeglobals.d_font_list);

	// report OpenGL information
	Sys_Printf ("GL_VENDOR: %s\n", qglGetString (GL_VENDOR));
	Sys_Printf ("GL_RENDERER: %s\n", qglGetString (GL_RENDERER));
	Sys_Printf ("GL_VERSION: %s\n", qglGetString (GL_VERSION));
	Sys_Printf ("GL_EXTENSIONS: %s\n", qglGetString (GL_EXTENSIONS));

  g_qeglobals.d_hwndCamera = GetSafeHwnd();

	return 0;
}