home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / sgi / 16279 < prev    next >
Encoding:
Text File  |  1992-11-11  |  2.6 KB  |  54 lines

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