blob: 5c3b8009bbe73fd29fcaa19602900c1512ef38a5 [file] [log] [blame]
Daniel Borcaf5e76292004-10-12 06:43:00 +00001 Mesa 6.3 DOS/DJGPP Port v1.7
Brian Paula75246f2003-10-02 17:36:43 +00002 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Brian Paul642699a2003-06-16 14:32:44 +00003
4
5
6Description:
7~~~~~~~~~~~~
8
Daniel Borcaf5e76292004-10-12 06:43:00 +00009Well, guess what... this is the DOS port of Mesa 6.3, for DJGPP fans... Whoa!
Brian Paul642699a2003-06-16 14:32:44 +000010The driver has its origins in ddsample.c, written by Brian Paul and found by me
11in Mesa 3.4.2.
12
13
14
15Legal:
16~~~~~~
17
18Mesa copyright applies, provided this package is used within Mesa. For anything
19else, see GPL.
20
21
22
23Installation:
24~~~~~~~~~~~~~
25
26Unzip and type:
27
28 make -f Makefile.DJ [OPTIONS...]
29
30Available options:
31
32 Environment variables:
33 CPU optimize for the given processor.
Brian Paul9ec58c22003-08-19 15:52:51 +000034 default = pentium
Brian Paul642699a2003-06-16 14:32:44 +000035 GLU=[mesa|sgi] specify GLU directory; can be `sgi' (requires GNU/C++)
36 or `mesa'.
37 default = mesa
Brian Paul9ec58c22003-08-19 15:52:51 +000038 GLIDE path to Glide3 SDK; used with FX.
39 default = $(TOP)/glide3
Brian Paul642699a2003-06-16 14:32:44 +000040 FX=1 build for 3dfx Glide3. Note that this disables
41 compilation of most DMesa code and requires fxMesa.
42 As a consequence, you'll need the DJGPP Glide3
43 library to build any application.
44 default = no
Daniel Borcad3746ca2004-04-07 06:37:50 +000045 X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
Brian Paul642699a2003-06-16 14:32:44 +000046 default = no
47
48 Targets:
49 all: build everything
50 libgl: build GL
51 libglu: build GLU
52 libglut: build GLUT
53 clean: remove object files
54 realclean: remove all generated files
55
56
57
58Tested on:
Brian Paul4e28d962003-06-30 21:51:31 +000059 CPU: AMD Athlon XP 1800+
Daniel Borca0849ed12004-01-15 07:17:31 +000060 Mainboard: GA-7VTXE w/ 512 MB DDRAM
Daniel Borca28442852003-12-10 15:24:49 +000061 Video card: Voodoo5 6000 AGP w/ 128 MB SDRAM
Daniel Borca65dfab62004-12-15 07:56:49 +000062 DJGPP: djdev 2.04 + gcc v3.4.3 + make v3.80
Brian Paul642699a2003-06-16 14:32:44 +000063 OS: DOS and Win98SE
64
65
66
67FAQ:
68~~~~
69
701. Compilation
71
Brian Paul44c69992003-07-11 16:33:43 +000072 Q) `make' barfs and exits because it cannot find some stupid file.
Brian Paul642699a2003-06-16 14:32:44 +000073 A) You need LFN support.
74 A) When compiling for Glide (FX=1), pay attention to Glide path.
75
76 Q) Libraries built OK, but linker complains about `vsnprintf' every time I
77 compile some demo.
78 A) Upgrade to DJGPP 2.04.
79 A) Add `vsnprintf.c' to the CORE_SOURCES in `src/Makefile.DJ' (untested!).
Brian Paul44c69992003-07-11 16:33:43 +000080 A) Patch `src/mesa/main/imports.c' with the following line:
Brian Paul642699a2003-06-16 14:32:44 +000081 #define vsnprintf(buf, max, fmt, arg) vsprintf(buf, fmt, arg)
Brian Paul44c69992003-07-11 16:33:43 +000082 This hack should be safe in 90% of the cases, but if anything goes wrong,
83 don't come back to me crying.
Brian Paul642699a2003-06-16 14:32:44 +000084
85 Q) `make' complains about DXE3 or something, yet it builds the libraries.
86 A) DXE3 refers to the DJGPP dynamic modules. You'll need either the latest
87 DJGPP distro, or download the separate package from my web page. Read the
88 DXE3 documentation on how to use them.
Brian Paul76096002003-08-28 16:57:01 +000089 A) When compiling for Glide (FX=1), make sure `glide3x.dxe' can be found in
Brian Paul642699a2003-06-16 14:32:44 +000090 LD_LIBRARY_PATH (or top `lib' directory).
91
922. Using Mesa for DJGPP
93
Daniel Borca8d88f822004-11-12 15:00:30 +000094 Q) Every test I tried crashes badly.
95 A) If you have compiled with SSE and you're running under plain DOS, you
96 have to disable SSE at run-time. See environment variables below.
97
Brian Paul642699a2003-06-16 14:32:44 +000098 Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much better...
Daniel Borcaf5e76292004-10-12 06:43:00 +000099 A) Is that a question? If you have a 3dfx Voodoo (any model), you're
Daniel Borcae9e98402003-12-19 11:26:46 +0000100 lucky (check http://sourceforge.net/projects/glide for the DJGPP port).
Brian Paul642699a2003-06-16 14:32:44 +0000101 If you haven't, sorry; everything is done in software. Suggestions?
102
103 Q) I tried to set refresh rate w/ DMesa, but without success.
Daniel Borca0849ed12004-01-15 07:17:31 +0000104 A) Refresh rate control works only for VESA 3.0 and the 3dfx driver (in
105 which case FX_GLIDE_REFRESH will be overwritten if it is defined and
106 is not 0).
Brian Paul642699a2003-06-16 14:32:44 +0000107
108 Q) I made a simple application and it does nothing. It exits right away. Not
109 even a blank screen.
Daniel Borcad039b432004-02-07 10:54:36 +0000110 A) Pure software drivers (VESA/VGA/NUL) support only double-buffered modes.
Brian Paul642699a2003-06-16 14:32:44 +0000111 A) Another weird "feature" is that buffer width must be multiple of 8 (I'm a
112 lazy programmer and I found that the easiest way to keep buffer handling
113 at peak performance ;-).
114
Daniel Borca3d06dc72004-01-23 15:57:52 +0000115 Q) I'm getting a "bad font!" fatal error.
116 A) By default, DOS GLUT compiles with GLUT_IMPORT_LIB, to cope with variable
117 access inside dynamic modules (same mechanism used for Win32 _DLL). Since
118 -DGLUT_IMPORT_LIB affects Mesa's `glut.h', your apps must be compiled the
119 same way GLUT was compiled (either with or without defining it). If you
120 want to use another `glut.h' when building your own demos, or just don't
121 feel happy about this, make sure you remove the line with GLUT_IMPORT_LIB
122 from `Mesa/src/glut/dos/Makefile.DJ' before (re)making GLUT. Beware, this
123 means you will never EVER be able to safely use `glut.dxe'!
124
Daniel Borcad039b432004-02-07 10:54:36 +0000125 Q) What is NUL driver good for, if I don't get any output at all?
126 A) For debugging. The NUL driver is very much like OSMesa. Everything is
Daniel Borca2aa84492004-02-20 09:47:42 +0000127 done just the same as VESA/VGA drivers, only it doesn't touch your video
128 hardware. You can query the actual buffer by issuing:
Daniel Borcad039b432004-02-07 10:54:36 +0000129 DMesaGetIntegerv(DMESA_GET_BUFFER_ADDR, &buffer);
130 and dump it to a file.
131
Daniel Borcae9e98402003-12-19 11:26:46 +0000132 Q) How do I query for a list of available video modes to choose as a visual?
133 A) This is an ugly hack, for which I'm sure I'll burn in hell.
134 First, query for a list of modes:
135 n = DMesaGetIntegerv(DMESA_GET_VIDEO_MODES, NULL);
136 If `n' is strictly positive, you allocate an array of pointers to a given
137 struct (which is guaranteed to be extended only - not changed in future):
138 struct {
139 int xres, yres;
140 int bpp;
Daniel Borcaf5e76292004-10-12 06:43:00 +0000141 } **l = malloc(n * sizeof(void *));
Daniel Borcae9e98402003-12-19 11:26:46 +0000142 Now pass the newly allocated buffer to fill in:
143 DMesaGetIntegerv(DMESA_GET_VIDEO_MODES, (GLint *)l);
144 And collect the info:
145 for (i = 0; i < n; i++) {
146 printf("%dx%d:%d\n", l[i]->xres, l[i]->yres, l[i]->bpp);
147 }
148
Brian Paul642699a2003-06-16 14:32:44 +0000149 Q) The GLUT is incomplete.
150 A) See below.
151
152
153
154libGLUT (the toolkit):
155~~~~~~~~~~~~~~~~~~~~~~
156
157Well, this "skeletal" GLUT implementation was taken from AllegGL project and
158heavily changed. Thanks should go to Bernhard Tschirren, Mark Kilgard, Brian
159Paul and probably others (or probably not ;-). GLUT functionality will be
160extended only on an "as needed" basis.
161
162GLUT talks to hardware via PC_HW package which was put together from various
163pieces I wrote long time ago. It consists from the keyboard, mouse and timer
164drivers.
165
166My keyboard driver used only scancodes; as GLUT requires ASCII values for keys,
167I borrowed the translation tables (and maybe more) from Allegro -- many thanks
168to Shawn Hargreaves et co. Ctrl-Alt-Del (plus Ctrl-Alt-End, for Windows users)
169will shut down the GLUT engine unconditionally: it will raise SIGINT, which in
170turn will (hopefully) call the destructors, thus cleaning up your/my mess ;-)
171NB: since the DJGPP guys ensured signal handlers won't go beyond program's
172space (and since dynamic modules shall) the SIGINT can't be hooked (well, it
173can, but it is useless), therefore you must live with the 'Exiting due to
174signal SIGINT' message...
175
176The mouse driver is far from complete (lack of drawing, etc), but is enough to
177make almost all the demos work. Supports the CuteMouse WheelAPI.
178
179The timer is pretty versatile for it supports multiple timers with different
180frequencies. While not being the most accurate timer in the known universe, I
181think it's OK. Take this example: you have timer A with a very high rate, and
182then you have timer B with very low rate compared to A; now, A ticks OK, but
183timer B will probably loose precision!
184
185As an addition, stdout and stderr are redirected and dumped upon exit. This
186means that `printf' can be safely called during graphics. A bit of a hack, I
187know, because all messages come in bulk, but I think it's better than nothing.
188"Borrowed" from LIBRHUTI (Robert Hoehne).
189
Brian Paul76096002003-08-28 16:57:01 +0000190Window creating defaults: (0, 0, 300, 300), 16bpp. However, the video mode is
191chosen in such a way that first window will fit. If you need high resolution
192with small windows, set initial position far to the right (or way down); then
193you can move them back to any position right before the main loop.
Brian Paul642699a2003-06-16 14:32:44 +0000194
Daniel Borcad039b432004-02-07 10:54:36 +0000195
196
197Environment variables:
198~~~~~~~~~~~~~~~~~~~~~~
199 DMESA_NULDRV - (any value) force NUL driver
Brian Paul9ec58c22003-08-19 15:52:51 +0000200 GLUT_FPS - print frames/second statistics to stderr
Daniel Borca8d88f822004-11-12 15:00:30 +0000201 MESA_NO_SSE - (any value) safe option under pure DOS
Brian Paul642699a2003-06-16 14:32:44 +0000202 DMESA_GLUT_REFRESH - set vertical screen refresh rate (VESA3)
203 DMESA_GLUT_BPP - set default bits per pixel (VGA needs 8)
Brian Paul76096002003-08-28 16:57:01 +0000204 DMESA_GLUT_ALPHA - set default alpha bits (8)
205 DMESA_GLUT_DEPTH - set default depth bits (16)
206 DMESA_GLUT_STENCIL - set default stencil bits (8)
207 DMESA_GLUT_ACCUM - set default accum bits (16)
Brian Paul642699a2003-06-16 14:32:44 +0000208
209
210
211History:
212~~~~~~~~
213
214v1.0 (mar-2002)
215 initial release
216
217v1.1 (sep-2002)
218 + added 3dfx Glide3 support
219 + added refresh rate control
220 + added fonts in GLUT
221 * lots of minor changes
222
223v1.2 (nov-2002)
224 * synced w/ Mesa-4.1
225 - removed dmesadxe.h
226
227v1.3 (mar-2003)
228 + enabled OpenGL 1.4 support
229 + added MMX clear/blit routines
230 + enabled SGI's GLU compilation
231 + added samples makefile
232 + added new GLUT functions
233 + added color-index modes
234 + added Matrox Millennium MGA2064W driver
235 + added 8bit FakeColor (thanks to Neil Funk)
236 + added VGA support (to keep Ben Decker happy)
237 ! fixed some compilation errors (reported by Chan Kar Heng)
238 * optimized driver for faster callback access... yeah, right :)
239 * overhauled virtual buffer and internal video drivers
240 * better fxMesa integration
241 * revamped GLUT
242 * switched to DXE3
243
Daniel Borca28442852003-12-10 15:24:49 +0000244v1.4 (dec-2003)
Brian Paul4778beb2003-08-22 13:47:08 +0000245 + enabled GLUT fonts with DXE
Brian Paul76096002003-08-28 16:57:01 +0000246 + truly added multi-window support in GLUT (for Adrian Woodward)
Brian Paul642699a2003-06-16 14:32:44 +0000247 * accomodated makefiles with the new sourcetree
Brian Paul76096002003-08-28 16:57:01 +0000248 * fixed some ALPHA issues
Daniel Borcaef563d02003-11-18 12:18:13 +0000249 * minor changes to PC_HW/timer interface
Brian Paul76096002003-08-28 16:57:01 +0000250 x hacked and slashed the 3dfx driver (w/ help from Hiroshi Morii)
Brian Paul642699a2003-06-16 14:32:44 +0000251
Daniel Borca0849ed12004-01-15 07:17:31 +0000252v1.5 (jan-2004)
Daniel Borcae9e98402003-12-19 11:26:46 +0000253 + added interface to query available "visuals" (GLFW - Marcus Geelnard)
Daniel Borca0849ed12004-01-15 07:17:31 +0000254 + added GLUT timer callback
Daniel Borcae9e98402003-12-19 11:26:46 +0000255 - removed Matrox Millennium MGA2064W driver
Daniel Borca0849ed12004-01-15 07:17:31 +0000256 x more changes to the 3dfx driver
Daniel Borcae9e98402003-12-19 11:26:46 +0000257
Daniel Borca153f4792004-08-16 08:47:19 +0000258v1.6 (aug-2004)
Daniel Borcad039b432004-02-07 10:54:36 +0000259 + implemented NUL driver
Daniel Borca61bc62c2004-02-02 07:47:23 +0000260 + added DMesaGetProcAddress and glutGetProcAddress
Daniel Borca1440f732004-02-09 08:46:38 +0000261 * reorganized fxMesa wrapper to handle multiple contexts
Daniel Borca3d06dc72004-01-23 15:57:52 +0000262 ! fixed a horrible bug in VGA initialization routine
Daniel Borca15a0b082004-07-21 08:45:35 +0000263 ! fixed partial clears
Daniel Borcad4636e72004-01-20 14:15:35 +0000264
Daniel Borca65dfab62004-12-15 07:56:49 +0000265v1.7 (???-2005)
Daniel Borcaf5e76292004-10-12 06:43:00 +0000266 + enabled OpenGL 2.0 support
267 + added support for sw texture compression
Daniel Borca8d88f822004-11-12 15:00:30 +0000268 * minor rework
Daniel Borcaf5e76292004-10-12 06:43:00 +0000269
Brian Paul642699a2003-06-16 14:32:44 +0000270
271
272Contact:
273~~~~~~~~
274
Daniel Borca15a0b082004-07-21 08:45:35 +0000275Name: Daniel Borca
Brian Paul9ec58c22003-08-19 15:52:51 +0000276E-mail: dborca@users.sourceforge.net
Brian Paul642699a2003-06-16 14:32:44 +0000277WWW: http://www.geocities.com/dborca/