Characters, Display Lists - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

Characters, Display Lists

Description:

Notice that sans serif does not have extra flourishes at ... Blocky when expanded. Outline fonts: Represented as curve functions. Slow: needs to be rasterized ... – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 9
Provided by: csS1
Category:

less

Transcript and Presenter's Notes

Title: Characters, Display Lists


1
Characters, Display Lists
  • Soon Tee Teoh
  • CS 116A

2
Drawing Characters
  • Often need to display text
  • Classification
  • Typeface Different designs eg.
  • Courier, Times Roman, Arial, Microsoft Sans Serif
  • Font Typeface and size fixed eg.
  • 28-point Courier italic

3
Serif and sans-serif
  • Two broad groups of typeface serif and
    sans-serif, eg.
  • Palatino serif
  • Lucina Sans sans serif
  • Notice that sans serif does not have extra
    flourishes at the end of strokes.
  • Serif is easier to read lots of. Sans serif is
    easier to recognize single characters

4
Proportionally-spaced or constant-spaced
  • Is this proportionally-spaced or constant spaced?
  • XGMXXKWWW
  • iiitttlll

5
Computer Representation
  • 2 types
  • Bitmap (raster)
  • Outline (stroke,vector)
  • Bitmap fonts represented as bitmaps
  • Need one bitmap for each style
  • Multiples of pixel size
  • Blocky when expanded
  • Outline fonts Represented as curve functions
  • Slow needs to be rasterized
  • Flexible size can be adjusted, good quality

6
OpenGL Character Functions
  • For bitmapped fonts can use
  • glRasterPos2i(x,y)
  • font GLUT_BITMAP_9_BY_15
  • characterb
  • glutBitmapCharacter(font, character)
  • glutBitmapCharacter(font, o)
  • For Stroke Characters you can use
  • fontGLUT_STROKE_MONO_ROMAN
  • glutStrokeCharacter(font,b)

Stroke Character example (function to draw a
string)
void output(GLfloat x, GLfloat y, char text)
char p glPushMatrix() glTranslatef(x,
y, 0) for (p text p p)
glutStrokeCharacter(GLUT_STROKE_ROMAN, p)
glPopMatrix()
7
OpenGL Characters
Note For stroke characters, the maximum top
character in the font is 119.05 units the bottom
descends 33.33 units. For GLUT_STROKE_MONO_ROMAN,
each character is 104.76 units wide.
8
OpenGL Display Lists
  • Store some set of OpenGL commands
  • Then you can call it later at any time, eg.
  • Make display list describing scene
  • Then call the list using different viewing
    parameters

GLuint ID ID glGenLists(1) glNewList (ID,
GL_COMPILE) // or GL_COMPILE_AND_EXECUTE glE
ndList() glCallList(ID)
glColor3f(1.0,0.0,0.0) glBegin(GL_QUADS) glVertex
3f(1.0,0.0,0.0) glVertex3f(1.0,1.0,0.0) glVertex
3f(0.0,1.0,0.0) glVertex3f(0.0,0.0,0.0) glEnd()
Write a Comment
User Comments (0)
About PowerShow.com