void gtk_glwidget_create_font (GtkWidget *widget) { PangoFontDescription *font_desc; PangoFont *font; PangoFontMetrics *font_metrics; font_list_base = qglGenLists (256); font_desc = pango_font_description_from_string (font_string); font = gdk_gl_font_use_pango_font (font_desc, 0, 256, font_list_base); if(font != NULL) { font_metrics = pango_font_get_metrics (font, NULL); font_height = pango_font_metrics_get_ascent (font_metrics) + pango_font_metrics_get_descent (font_metrics); font_height = PANGO_PIXELS (font_height); pango_font_metrics_unref (font_metrics); } pango_font_description_free (font_desc); }
void WINAPI Pointfile_Check (void) { char name[1024]; FILE *f; idVec3 v; strcpy (name, currentmap); StripExtension (name); strcat (name, ".lin"); f = fopen (name, "r"); if (!f) return; common->Printf ("Reading pointfile %s\n", name); if (!g_qeglobals.d_pointfile_display_list) g_qeglobals.d_pointfile_display_list = qglGenLists(1); s_num_points = 0; qglNewList (g_qeglobals.d_pointfile_display_list, GL_COMPILE); qglColor3f (1, 0, 0); qglDisable(GL_TEXTURE_2D); qglDisable(GL_TEXTURE_1D); qglLineWidth (2); qglBegin(GL_LINE_STRIP); do { if (fscanf (f, "%f %f %f\n", &v[0], &v[1], &v[2]) != 3) break; if (s_num_points < MAX_POINTFILE) { VectorCopy (v, s_pointvecs[s_num_points]); s_num_points++; } qglVertex3fv( v.ToFloatPtr() ); } while (1); qglEnd(); qglLineWidth (0.5); qglEndList (); s_check_point = 0; fclose (f); //Pointfile_Next (); }
/* ** 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; }
/* ================== R_NV20_Init ================== */ void R_NV20_Init(void) { glConfig.allowNV20Path = false; common->Printf("---------- R_NV20_Init ----------\n"); if (!glConfig.registerCombinersAvailable || !glConfig.ARBVertexProgramAvailable || glConfig.maxTextureUnits < 4) { common->Printf("Not available.\n"); return; } GL_CheckErrors(); // create our "fragment program" display lists fragmentDisplayListBase = qglGenLists(FPROG_NUM_FRAGMENT_PROGRAMS); // force them to issue commands to build the list bool temp = r_useCombinerDisplayLists.GetBool(); r_useCombinerDisplayLists.SetBool(false); qglNewList(fragmentDisplayListBase + FPROG_BUMP_AND_LIGHT, GL_COMPILE); RB_NV20_BumpAndLightFragment(); qglEndList(); qglNewList(fragmentDisplayListBase + FPROG_DIFFUSE_COLOR, GL_COMPILE); RB_NV20_DiffuseColorFragment(); qglEndList(); qglNewList(fragmentDisplayListBase + FPROG_SPECULAR_COLOR, GL_COMPILE); RB_NV20_SpecularColorFragment(); qglEndList(); qglNewList(fragmentDisplayListBase + FPROG_DIFFUSE_AND_SPECULAR_COLOR, GL_COMPILE); RB_NV20_DiffuseAndSpecularColorFragment(); qglEndList(); r_useCombinerDisplayLists.SetBool(temp); common->Printf("---------------------------------\n"); glConfig.allowNV20Path = true; }
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; }