All pastes #620905 Raw Edit

spf wfl opengl font class

public text v1 · immutable
·published 2007-07-15 20:16 UTC
rendered paste body
WINAPI: glColor4f OpenGL32.DLL
WINAPI: glPushAttrib OpenGL32.DLL
WINAPI: glPopAttrib OpenGL32.DLL
WINAPI: glFlush OpenGL32.DLL

WINAPI: wglUseFontOutlinesA OpenGL32.DLL

WINAPI: glCallLists OpenGL32.DLL
WINAPI: glListBase OpenGL32.DLL

WINAPI: wglGetCurrentDC OpenGL32.DLL

WINAPI: CreateFontA GDI32.DLL

CLASS CGLText 

 VAR ubase
 256 CELLS DEFS agmf
 VAR font
 VAR hdc 
 
: zinit
   hdc !
   \ Storage For 256 Characters		
   256 glGenLists ubase !
   
   S" Comic Sans MS" DROP \ Font Name		   
   FF_DONTCARE DEFAULT_PITCH OR \ Family And Pitch		
   ANTIALIASED_QUALITY  \ Output Quality		
   CLIP_DEFAULT_PRECIS \ Clipping Precision		
   OUT_TT_PRECIS \ Output Precision		
   ANSI_CHARSET \ Character Set Identifier		   
   FALSE \ Strikeout		
   FALSE \ Underline
   FALSE \ Italic
  \ You can put a number from 0 - 1000 or you can use one of the predefined values. 
  \ FW_DONTCARE is 0, FW_NORMAL is 400, FW_BOLD is 700 and FW_BLACK is 900. 
   FW_BOLD \ Font Weight		
   0 \ Orientation Angle		
   0 \ Angle Of Escapement
   0 \ Width Of Font		
   -12 \ Height Of Font	
   CreateFontA font !
   
   font @ hdc @ SelectObject DROP \ Selects The Font We Created		

   agmf @ \ Address Of Buffer To Recieve Data
   WGL_FONT_POLYGONS \ Use Polygons, Not Lines
   0.2e float \ Font Thickness In The Z Direction
   0.0e float \ deviation from the true outlines
   ubase @ \ displist start
   255 \ Number of display lists
   0 \ Starting character
   hdc @ wglUseFontOutlinesA
   0= S" wglUseFontOutlinesA FAILED!!" SUPER abort 
   ;

: write { a u }
  GL_MODELVIEW glMatrixMode DROP
  glPushMatrix DROP

  GL_LIST_BIT glPushAttrib DROP

  \ set up for a string-drawing display list call
  ubase @ glListBase DROP \ magic
  a GL_UNSIGNED_BYTE u glCallLists DROP

  glFlush DROP
  glPopAttrib DROP

  glPopMatrix DROP
;
   
;CLASS