Merge branch 'master' of ssh://repo.or.cz/srv/git/tgl
[tgl.git] / README.TinyGL
blob82421e108be786c8fccb7ceaa61e3d84069eb547
1 TinyGL 0.4 (c) 1997-2002 Fabrice Bellard.
3 General Description:
4 --------------------
6 TinyGL is intended to be a very small implementation of a subset of
7 OpenGL* for embedded systems or games. It is a software only
8 implementation. Only the main OpenGL calls are implemented. All the
9 calls I considered not important are simply *not implemented*.
11 The main strength of TinyGL is that it is fast and simple because it
12 has not to be exactly compatible with OpenGL. In particular, the
13 texture mapping and the geometrical transformations are very fast.
15 The main features of TinyGL are:
17 - Header compatible with OpenGL (the headers are adapted from the very good
18 Mesa by Brian Paul et al.)
20 - Zlib-like licence for easy integration in commercial designs (read
21 the LICENCE file).
23 - Subset of GLX for easy testing with X Window. 
25 - GLX like API (NGLX) to use it with NanoX in MicroWindows/NanoX.
27 - Subset of BGLView under BeOS.
29 - OpenGL like lightening.
31 - Complete OpenGL selection mode handling for object picking.
33 - 16 bit Z buffer. 16/24/32 bit RGB rendering. High speed dithering to
34 paletted 8 bits if needed. High speed conversion to 24 bit packed
35 pixel or 32 bit RGBA if needed.
37 - Fast Gouraud shadding optimized for 16 bit RGB.
39 - Fast texture mapping capabilities, with perspective correction and
40 texture objects.
42 - 32 bit float only arithmetic.
44 - Very small: compiled code size of about 40 kB on x86. The file
45   src/zfeatures.h can be used to remove some unused features from
46   TinyGL.
48 - C sources for GCC on 32/64 bit architectures. It has been tested
49 succesfully on x86-Linux and sparc-Solaris.
51 Examples:
52 ---------
54 I took three simple examples from the Mesa package to test the main
55 functions of TinyGL. You can link them to either TinyGL, Mesa or any
56 other OpenGL/GLX implementation. You can also compile them with
57 Microwindows.
59 - texobj illustrates the use of texture objects. Its shows the speed
60 of TinyGL in this case.
62 - glutmech comes from the GLUT packages. It is much bigger and slower
63 because it uses the lightening. I have just included some GLU
64 functions and suppressed the GLUT related code to make it work. It
65 shows the display list handling of TinyGL in particular. You can look
66 at the source code to learn the keys to move the robot. The key 't'
67 toggles between shaded rendering and wire frame.
69 - You can download and compile the VReng project to see that TinyGL
70 has been successfully used in a big project
71 (http://www-inf.enst.fr/vreng).
73 Architecture:
74 -------------
76 TinyGL is made up four main modules:
78 - Mathematical routines (zmath).
80 - OpenGL-like emulation (zgl).
82 - Z buffer and rasterisation (zbuffer).
84 - GLX interface (zglx).
86 To use TinyGL in an embedded system, you should look at the GLX layer
87 and modify it to suit your need. Adding a more user friendly
88 developper layer (as in Mesa) may be useful.
90 Notes - limitations:
91 --------------------
93 - See the file 'LIMITATIONS' to see the current functions supported by the API.
95 - The multithreading could be easily implemented since no global state
96 is maintainted. The library gets the current context with a function
97 which can be modified.
99 - The lightening is not very fast. I supposed that in most games the
100 lightening is computed by the 3D engine.
102 - Some changes are needed for 64 bit pointers for the handling of
103 arrays of float with the GLParam union.
105 - List sharing is partialy supported in the source, but not by the
106 current TinyGLX implementation (is it really useful ?).
108 - No user clipping planes are supported.
110 - No color index mode (no longer useful !)
112 - The mipmapping is not implemented.
114 - The perspecture correction in the mapping code does not use W but
115 1/Z. In any 'normal scene' it should work.
117 - The resizing of the viewport in TinyGLX ensures that the width and
118 the height are multiples of 4. This is not optimal because some pixels
119 of the window may not be refreshed.
121 Why ?
122 -----
124 TinyGL was developped as a student project for a Virtual Reality
125 network system called VReng (see the VReng home page at
126 http://www-inf.enst.fr/vreng).
128 At that time (January 1997), my initial project was to write my own 3D
129 rasterizer based on some old sources I wrote. But I realized that it
130 would be better to use OpenGL to work on any platform. My problem was
131 that I wanted to use texture mapping which was (and is still) quite
132 slower on many software OpenGL implementation. I could have modified
133 Mesa to suit my needs, but I really wanted to use my old sources for
134 that project. 
136 I finally decided to use the same syntax as OpenGL but with my own
137 libraries, thinking that later it could ease the porting of VReng to
138 OpenGL.
140 Now VReng is at last compatible with OpenGL, and I managed to patch
141 TinyGL so that VReng can still work with it without any modifications.
143 Since TinyGL may be useful for some people, especially in the world of
144 embedded designs, I decided to release it 'as is', otherwise, it would
145 have been lost on my hard disk !
147 ------------------------------------------------------------------------------
148 * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
149 ------------------------------------------------------------------------------
150 Fabrice Bellard.