blob: 5f783ac53fb7f20421f7e20744c5072887350c11 [file] [log] [blame]
Daniel Borca3a3e63d2006-03-31 20:53:12 +00001 Mesa 6.5 DOS/DJGPP Port v1.8
Brian Paula75246f2003-10-02 17:36:43 +00002 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Brian Paul642699a2003-06-16 14:32:44 +00003
4
5
6Description:
7~~~~~~~~~~~~
8
Daniel Borca75f81ad2006-04-01 13:38:45 +00009Well, guess what... this is the DOS port of Mesa 6.5, for DJGPP fans... Whoa!
10The driver uses OSMesa to draw off screen, and then blits the buffer. This is
11not terribly efficient, and has some drawbacks, but saves maintenance costs.
Brian Paul642699a2003-06-16 14:32:44 +000012
13
14
15Legal:
16~~~~~~
17
Daniel Borca75f81ad2006-04-01 13:38:45 +000018Mesa copyright applies.
Brian Paul642699a2003-06-16 14:32:44 +000019
20
21
22Installation:
23~~~~~~~~~~~~~
24
25Unzip and type:
26
27 make -f Makefile.DJ [OPTIONS...]
28
29Available options:
30
31 Environment variables:
32 CPU optimize for the given processor.
Brian Paul9ec58c22003-08-19 15:52:51 +000033 default = pentium
Brian Paul9ec58c22003-08-19 15:52:51 +000034 GLIDE path to Glide3 SDK; used with FX.
35 default = $(TOP)/glide3
Brian Paul642699a2003-06-16 14:32:44 +000036 FX=1 build for 3dfx Glide3. Note that this disables
37 compilation of most DMesa code and requires fxMesa.
38 As a consequence, you'll need the DJGPP Glide3
39 library to build any application.
40 default = no
Daniel Borcad3746ca2004-04-07 06:37:50 +000041 X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
Brian Paul642699a2003-06-16 14:32:44 +000042 default = no
43
44 Targets:
45 all: build everything
46 libgl: build GL
47 libglu: build GLU
48 libglut: build GLUT
49 clean: remove object files
50 realclean: remove all generated files
51
52
53
54Tested on:
Daniel Borca3a3e63d2006-03-31 20:53:12 +000055 Video card: Radeon 9500
56 DJGPP: djdev 2.04 + gcc v4.1.0 + make v3.80
57 OS: DOS, Win98SE, WinXP (using Videoport driver)
Brian Paul642699a2003-06-16 14:32:44 +000058
59
60
61FAQ:
62~~~~
63
641. Compilation
65
Brian Paul44c69992003-07-11 16:33:43 +000066 Q) `make' barfs and exits because it cannot find some stupid file.
Brian Paul642699a2003-06-16 14:32:44 +000067 A) You need LFN support.
68 A) When compiling for Glide (FX=1), pay attention to Glide path.
69
70 Q) Libraries built OK, but linker complains about `vsnprintf' every time I
71 compile some demo.
72 A) Upgrade to DJGPP 2.04.
73 A) Add `vsnprintf.c' to the CORE_SOURCES in `src/Makefile.DJ' (untested!).
Brian Paul44c69992003-07-11 16:33:43 +000074 A) Patch `src/mesa/main/imports.c' with the following line:
Brian Paul642699a2003-06-16 14:32:44 +000075 #define vsnprintf(buf, max, fmt, arg) vsprintf(buf, fmt, arg)
Brian Paul44c69992003-07-11 16:33:43 +000076 This hack should be safe in 90% of the cases, but if anything goes wrong,
77 don't come back to me crying.
Brian Paul642699a2003-06-16 14:32:44 +000078
79 Q) `make' complains about DXE3 or something, yet it builds the libraries.
80 A) DXE3 refers to the DJGPP dynamic modules. You'll need either the latest
81 DJGPP distro, or download the separate package from my web page. Read the
82 DXE3 documentation on how to use them.
Brian Paul76096002003-08-28 16:57:01 +000083 A) When compiling for Glide (FX=1), make sure `glide3x.dxe' can be found in
Brian Paul642699a2003-06-16 14:32:44 +000084 LD_LIBRARY_PATH (or top `lib' directory).
85
862. Using Mesa for DJGPP
87
Daniel Borca8d88f822004-11-12 15:00:30 +000088 Q) Every test I tried crashes badly.
89 A) If you have compiled with SSE and you're running under plain DOS, you
90 have to disable SSE at run-time. See environment variables below.
91
Brian Paul642699a2003-06-16 14:32:44 +000092 Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much better...
Daniel Borcaf5e76292004-10-12 06:43:00 +000093 A) Is that a question? If you have a 3dfx Voodoo (any model), you're
Daniel Borcae9e98402003-12-19 11:26:46 +000094 lucky (check http://sourceforge.net/projects/glide for the DJGPP port).
Daniel Borca3a3e63d2006-03-31 20:53:12 +000095 If you haven't, sorry; everything is done in software.
Brian Paul642699a2003-06-16 14:32:44 +000096
97 Q) I tried to set refresh rate w/ DMesa, but without success.
Daniel Borca0849ed12004-01-15 07:17:31 +000098 A) Refresh rate control works only for VESA 3.0 and the 3dfx driver (in
99 which case FX_GLIDE_REFRESH will be overwritten if it is defined and
100 is not 0).
Brian Paul642699a2003-06-16 14:32:44 +0000101
102 Q) I made a simple application and it does nothing. It exits right away. Not
103 even a blank screen.
Daniel Borca3a3e63d2006-03-31 20:53:12 +0000104 A) Software drivers (VESA/VGA/NUL) must to be constructed as single-buffered
105 visuals. However, DMesaSwapBuffers must be called to get any output.
Brian Paul642699a2003-06-16 14:32:44 +0000106 A) Another weird "feature" is that buffer width must be multiple of 8 (I'm a
107 lazy programmer and I found that the easiest way to keep buffer handling
108 at peak performance ;-).
109
Daniel Borca3d06dc72004-01-23 15:57:52 +0000110 Q) I'm getting a "bad font!" fatal error.
Daniel Borcaa5f2dcb2005-02-14 15:06:50 +0000111 A) Always use GLUT_STROKE_* and GLUT_BITMAP_* constants when dealing with
112 GLUT fonts. If you're using `glut.dxe', then make sure GLUT_STROKE_* and
113 GLUT_BITMAP_* are mapped to integer constants, not to the actual font
114 address (same mechanism used for Win32 _DLL).
Daniel Borca3d06dc72004-01-23 15:57:52 +0000115
Daniel Borcad039b432004-02-07 10:54:36 +0000116 Q) What is NUL driver good for, if I don't get any output at all?
117 A) For debugging. The NUL driver is very much like OSMesa. Everything is
Daniel Borca2aa84492004-02-20 09:47:42 +0000118 done just the same as VESA/VGA drivers, only it doesn't touch your video
119 hardware. You can query the actual buffer by issuing:
Daniel Borcad039b432004-02-07 10:54:36 +0000120 DMesaGetIntegerv(DMESA_GET_BUFFER_ADDR, &buffer);
121 and dump it to a file.
122
Daniel Borcae9e98402003-12-19 11:26:46 +0000123 Q) How do I query for a list of available video modes to choose as a visual?
124 A) This is an ugly hack, for which I'm sure I'll burn in hell.
125 First, query for a list of modes:
126 n = DMesaGetIntegerv(DMESA_GET_VIDEO_MODES, NULL);
127 If `n' is strictly positive, you allocate an array of pointers to a given
128 struct (which is guaranteed to be extended only - not changed in future):
129 struct {
130 int xres, yres;
131 int bpp;
Daniel Borcaf5e76292004-10-12 06:43:00 +0000132 } **l = malloc(n * sizeof(void *));
Daniel Borcae9e98402003-12-19 11:26:46 +0000133 Now pass the newly allocated buffer to fill in:
134 DMesaGetIntegerv(DMESA_GET_VIDEO_MODES, (GLint *)l);
135 And collect the info:
136 for (i = 0; i < n; i++) {
137 printf("%dx%d:%d\n", l[i]->xres, l[i]->yres, l[i]->bpp);
138 }
139
Brian Paul642699a2003-06-16 14:32:44 +0000140 Q) The GLUT is incomplete.
141 A) See below.
142
143
144
145libGLUT (the toolkit):
146~~~~~~~~~~~~~~~~~~~~~~
147
148Well, this "skeletal" GLUT implementation was taken from AllegGL project and
149heavily changed. Thanks should go to Bernhard Tschirren, Mark Kilgard, Brian
150Paul and probably others (or probably not ;-). GLUT functionality will be
151extended only on an "as needed" basis.
152
153GLUT talks to hardware via PC_HW package which was put together from various
154pieces I wrote long time ago. It consists from the keyboard, mouse and timer
155drivers.
156
157My keyboard driver used only scancodes; as GLUT requires ASCII values for keys,
158I borrowed the translation tables (and maybe more) from Allegro -- many thanks
159to Shawn Hargreaves et co. Ctrl-Alt-Del (plus Ctrl-Alt-End, for Windows users)
160will shut down the GLUT engine unconditionally: it will raise SIGINT, which in
161turn will (hopefully) call the destructors, thus cleaning up your/my mess ;-)
162NB: since the DJGPP guys ensured signal handlers won't go beyond program's
163space (and since dynamic modules shall) the SIGINT can't be hooked (well, it
164can, but it is useless), therefore you must live with the 'Exiting due to
165signal SIGINT' message...
166
167The mouse driver is far from complete (lack of drawing, etc), but is enough to
168make almost all the demos work. Supports the CuteMouse WheelAPI.
169
170The timer is pretty versatile for it supports multiple timers with different
171frequencies. While not being the most accurate timer in the known universe, I
172think it's OK. Take this example: you have timer A with a very high rate, and
173then you have timer B with very low rate compared to A; now, A ticks OK, but
174timer B will probably loose precision!
175
176As an addition, stdout and stderr are redirected and dumped upon exit. This
177means that `printf' can be safely called during graphics. A bit of a hack, I
178know, because all messages come in bulk, but I think it's better than nothing.
179"Borrowed" from LIBRHUTI (Robert Hoehne).
180
Brian Paul76096002003-08-28 16:57:01 +0000181Window creating defaults: (0, 0, 300, 300), 16bpp. However, the video mode is
182chosen in such a way that first window will fit. If you need high resolution
183with small windows, set initial position far to the right (or way down); then
184you can move them back to any position right before the main loop.
Brian Paul642699a2003-06-16 14:32:44 +0000185
Daniel Borcad039b432004-02-07 10:54:36 +0000186
187
188Environment variables:
189~~~~~~~~~~~~~~~~~~~~~~
190 DMESA_NULDRV - (any value) force NUL driver
Brian Paul9ec58c22003-08-19 15:52:51 +0000191 GLUT_FPS - print frames/second statistics to stderr
Daniel Borca8d88f822004-11-12 15:00:30 +0000192 MESA_NO_SSE - (any value) safe option under pure DOS
Brian Paul642699a2003-06-16 14:32:44 +0000193 DMESA_GLUT_REFRESH - set vertical screen refresh rate (VESA3)
194 DMESA_GLUT_BPP - set default bits per pixel (VGA needs 8)
Brian Paul76096002003-08-28 16:57:01 +0000195 DMESA_GLUT_ALPHA - set default alpha bits (8)
196 DMESA_GLUT_DEPTH - set default depth bits (16)
197 DMESA_GLUT_STENCIL - set default stencil bits (8)
198 DMESA_GLUT_ACCUM - set default accum bits (16)
Brian Paul642699a2003-06-16 14:32:44 +0000199
200
201
202History:
203~~~~~~~~
204
205v1.0 (mar-2002)
206 initial release
207
208v1.1 (sep-2002)
209 + added 3dfx Glide3 support
210 + added refresh rate control
211 + added fonts in GLUT
212 * lots of minor changes
213
214v1.2 (nov-2002)
215 * synced w/ Mesa-4.1
216 - removed dmesadxe.h
217
218v1.3 (mar-2003)
219 + enabled OpenGL 1.4 support
220 + added MMX clear/blit routines
221 + enabled SGI's GLU compilation
222 + added samples makefile
223 + added new GLUT functions
224 + added color-index modes
225 + added Matrox Millennium MGA2064W driver
226 + added 8bit FakeColor (thanks to Neil Funk)
227 + added VGA support (to keep Ben Decker happy)
228 ! fixed some compilation errors (reported by Chan Kar Heng)
229 * optimized driver for faster callback access... yeah, right :)
230 * overhauled virtual buffer and internal video drivers
231 * better fxMesa integration
232 * revamped GLUT
233 * switched to DXE3
234
Daniel Borca28442852003-12-10 15:24:49 +0000235v1.4 (dec-2003)
Brian Paul4778beb2003-08-22 13:47:08 +0000236 + enabled GLUT fonts with DXE
Brian Paul76096002003-08-28 16:57:01 +0000237 + truly added multi-window support in GLUT (for Adrian Woodward)
Brian Paul642699a2003-06-16 14:32:44 +0000238 * accomodated makefiles with the new sourcetree
Brian Paul76096002003-08-28 16:57:01 +0000239 * fixed some ALPHA issues
Daniel Borcaef563d02003-11-18 12:18:13 +0000240 * minor changes to PC_HW/timer interface
Brian Paul76096002003-08-28 16:57:01 +0000241 x hacked and slashed the 3dfx driver (w/ help from Hiroshi Morii)
Brian Paul642699a2003-06-16 14:32:44 +0000242
Daniel Borca0849ed12004-01-15 07:17:31 +0000243v1.5 (jan-2004)
Daniel Borcae9e98402003-12-19 11:26:46 +0000244 + added interface to query available "visuals" (GLFW - Marcus Geelnard)
Daniel Borca0849ed12004-01-15 07:17:31 +0000245 + added GLUT timer callback
Daniel Borcae9e98402003-12-19 11:26:46 +0000246 - removed Matrox Millennium MGA2064W driver
Daniel Borca0849ed12004-01-15 07:17:31 +0000247 x more changes to the 3dfx driver
Daniel Borcae9e98402003-12-19 11:26:46 +0000248
Daniel Borca153f4792004-08-16 08:47:19 +0000249v1.6 (aug-2004)
Daniel Borcad039b432004-02-07 10:54:36 +0000250 + implemented NUL driver
Daniel Borca61bc62c2004-02-02 07:47:23 +0000251 + added DMesaGetProcAddress and glutGetProcAddress
Daniel Borca1440f732004-02-09 08:46:38 +0000252 * reorganized fxMesa wrapper to handle multiple contexts
Daniel Borca3d06dc72004-01-23 15:57:52 +0000253 ! fixed a horrible bug in VGA initialization routine
Daniel Borca15a0b082004-07-21 08:45:35 +0000254 ! fixed partial clears
Daniel Borcad4636e72004-01-20 14:15:35 +0000255
Daniel Borca65dfab62004-12-15 07:56:49 +0000256v1.7 (???-2005)
Daniel Borcaf5e76292004-10-12 06:43:00 +0000257 + enabled OpenGL 2.0 support
258 + added support for sw texture compression
Daniel Borcaa5f2dcb2005-02-14 15:06:50 +0000259 + added FreeGLUT specific functions
260 * no more GLX sources in DOS GLUT
261 * made GLUT timer callbacks less accurate but safer
Daniel Borcaf5e76292004-10-12 06:43:00 +0000262
Daniel Borca3a3e63d2006-03-31 20:53:12 +0000263v1.8 (apr-2006)
264 * killed lots of code, the driver is now a front-end to OSMesa
265 * fixed problem with WinNT (http://www.volny.cz/martin.sulak/)
266 - removed 3dfx Glide3 support (temporarily?)
267
Brian Paul642699a2003-06-16 14:32:44 +0000268
269
270Contact:
271~~~~~~~~
272
Daniel Borca15a0b082004-07-21 08:45:35 +0000273Name: Daniel Borca
Brian Paul9ec58c22003-08-19 15:52:51 +0000274E-mail: dborca@users.sourceforge.net
Brian Paul642699a2003-06-16 14:32:44 +0000275WWW: http://www.geocities.com/dborca/