home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!network.ucsd.edu!swrinde!zaphod.mps.ohio-state.edu!darwin.sura.net!sgiblab!sgigate!odin!news
- From: ib@ivan.asd.sgi.com (Ivan Bach)
- Subject: Re: GL hacks - Rotating text
- Message-ID: <1992Nov11.171208.27788@odin.corp.sgi.com>
- Keywords: GL, text rotation
- Sender: news@odin.corp.sgi.com (Net News)
- Nntp-Posting-Host: ivan.asd.sgi.com
- Organization: Silicon Graphics, Inc., Mountain View, CA
- References: <maejohns@bronze.ucs.indiana.edu>
- Date: Wed, 11 Nov 1992 17:12:08 GMT
- Lines: 40
-
- In article <BxIqvu.B17@usenet.ucs.indiana.edu Mark E. Johnson
- <maejohns@bronze.ucs.indiana.edu> writes:
- > Suppose I wish to draw labeled cubes (similar to wooden blocks
- > with letters on their sides) and have them rotate all over the place...
- > Has anyone written code to do someting similar, say with the fm calls
- > I know how to rotate things around, but am having a hard time with the
- > letters.
- It is easy to rotate text in two dimensions by using Display PostScript (DPS)
- or the IRIS Font Manager (FM). The design of the IRIS FM was patterned after
- PostScript. You request fonts by specifying a PostScript font name and point
- size, the fm functions fmfindfont, fmscalefont, and fmsetfont correspond to
- the PostScript operators findfont, scalefont, and setfont, DPS and FM use 3x3
- transformation matrices, etc.
-
- Why is it difficult to rotate text in three dimensions by using DPS or FM?
- Because PostScript is a 2D page description language. A two-dimensional
- transformation is usually described mathematically as a 3x3 matrix of the
- form:
-
- [ a b 0 ]
- [ c d 0 ]
- [ tx ty 1 ]
-
- You can use just six values to specify such a matrix, because the matrix
- elements in the third column always have the same values. Such matrices allow
- you to translate, scale, and rotate images in two dimensions. You need 4x4
- matrices to specify the kinds of transformations you want to do in three
- dimensions. You could use 4x4 matrices in your program to perform
- transformations in three dimensions, calculate the projection of your 3D scene
- on a 2D plane, and determine the elements of a 3x3 matrix. Then you could
- generate PostScript code that describes the projected image, or call
- appropriate fm functions.
-
- If you convert character outlines into line segments or polygons, then you
- can use GL commands to do much more with characters than can be done in
- PostScript. You can use shading, textures, lighting, anti-aliasing, fog, etc.
- You can make 2D or 3D characters fly across the screen, or simulate that a
- viewer is flying around stationary characters.
-
- Ivan Bach, ib@sgi.com
-