Compare commits
	
		
			120 Commits
		
	
	
		
			mesa-10.5.
			...
			mesa_5_0_1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 6faeeb59ba | ||
|  | 0670bb52e2 | ||
|  | 42ed7b78c3 | ||
|  | c44e5d39a5 | ||
|  | af709ec217 | ||
|  | c6c35a0d7e | ||
|  | 4ccebff103 | ||
|  | 0a89996605 | ||
|  | 3bff7aed0e | ||
|  | 605b7859c2 | ||
|  | bc0359a076 | ||
|  | 6677a919f1 | ||
|  | b099d2137e | ||
|  | b58c0dec59 | ||
|  | 9935d3434d | ||
|  | b28cbbf5a4 | ||
|  | a5213e2cac | ||
|  | e62a6bdb3a | ||
|  | 7709bd06f2 | ||
|  | 4b3f54ecb1 | ||
|  | 3a55d83d21 | ||
|  | 6899598be8 | ||
|  | 88db8b061b | ||
|  | 8b0f7c5ab7 | ||
|  | 683dba1164 | ||
|  | 4965446dbd | ||
|  | 9c3b611b85 | ||
|  | 48f8949cd2 | ||
|  | cd4fc963a4 | ||
|  | c24d9b330e | ||
|  | 62968d677c | ||
|  | 5e4a96980e | ||
|  | 6397f53174 | ||
|  | 3de75f6f68 | ||
|  | d1f324a779 | ||
|  | 3442cd9a9f | ||
|  | 324616ed83 | ||
|  | 6c59c0b9ec | ||
|  | 2ccb06cb4e | ||
|  | 7b1b099af3 | ||
|  | 6accaacbed | ||
|  | 30beb26dbb | ||
|  | 735a8aee5a | ||
|  | 764b1d5455 | ||
|  | b87a9089da | ||
|  | 69a4ff186a | ||
|  | d16d5fb06a | ||
|  | 8fee42cd6f | ||
|  | 34af895a99 | ||
|  | 4c5745b081 | ||
|  | dd2f83fb0e | ||
|  | 379c151989 | ||
|  | 379412994f | ||
|  | c5e6bd00be | ||
|  | bf490e3ae5 | ||
|  | 984f7e5324 | ||
|  | 7a23c68f35 | ||
|  | cb2eaf84a3 | ||
|  | 8829f949f8 | ||
|  | 015c4787d7 | ||
|  | 19c628d279 | ||
|  | 50bfa18670 | ||
|  | 57f9dc808a | ||
|  | ef2d42b144 | ||
|  | e3aa4c1d98 | ||
|  | d7facf95f8 | ||
|  | 3543b12519 | ||
|  | cfdb6711f8 | ||
|  | 283eab087b | ||
|  | 9c04e1c1d9 | ||
|  | 16a832fa89 | ||
|  | 5b8c98abee | ||
|  | 8126d169ec | ||
|  | 27a2f9fdfd | ||
|  | ad6514aac0 | ||
|  | de0c25a481 | ||
|  | a77151fb44 | ||
|  | df27002ac9 | ||
|  | 7e07dfb604 | ||
|  | 76cb735d0c | ||
|  | 530ce7f0ed | ||
|  | d856a056d3 | ||
|  | 7e7415fbab | ||
|  | 789d79e882 | ||
|  | 0e4e3606a3 | ||
|  | b53092916f | ||
|  | 92b132b966 | ||
|  | a5eb3c6a37 | ||
|  | 050268971b | ||
|  | dbdc9e92b5 | ||
|  | ca3d8e4605 | ||
|  | fc16876967 | ||
|  | 83666eb33f | ||
|  | adbf94ca38 | ||
|  | 7b3a50acf1 | ||
|  | 4396dd1a3b | ||
|  | 8f5f0fd6f8 | ||
|  | ce733f495e | ||
|  | b0e246bf9a | ||
|  | 7ffbdc48b6 | ||
|  | bd77908248 | ||
|  | b319c105ea | ||
|  | a987857ca5 | ||
|  | b6af31d4c6 | ||
|  | 3cfadcf097 | ||
|  | 10174c5efd | ||
|  | f24e9c8ad7 | ||
|  | 8f47c7f0df | ||
|  | dce96e2450 | ||
|  | c264409c46 | ||
|  | 83df49f95d | ||
|  | ffb4ef6929 | ||
|  | 1f7aeedf55 | ||
|  | 2e5a88ab6a | ||
|  | d520ff08d0 | ||
|  | ef0e1dcc2e | ||
|  | 6412641b19 | ||
|  | 3ee066b48f | ||
|  | 33c0b3e233 | ||
|  | 658145bd82 | 
| @@ -1,13 +1,13 @@ | |||||||
| # $Id: Make-config,v 1.67 2002/11/12 02:49:14 brianp Exp $ | # $Id: Make-config,v 1.67.2.1 2003/03/27 18:35:55 brianp Exp $ | ||||||
|  |  | ||||||
| MESA_MAJOR=5 | MESA_MAJOR=5 | ||||||
| MESA_MINOR=0 | MESA_MINOR=0 | ||||||
| MESA_TINY=0 | MESA_TINY=1 | ||||||
| VERSION=$(MESA_MAJOR).$(MESA_MINOR) | VERSION=$(MESA_MAJOR).$(MESA_MINOR) | ||||||
|  |  | ||||||
| # Mesa 3-D graphics library | # Mesa 3-D graphics library | ||||||
| #  | #  | ||||||
| # Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | # Copyright (C) 1999-2003  Brian Paul   All Rights Reserved. | ||||||
| #  | #  | ||||||
| # Permission is hereby granted, free of charge, to any person obtaining a | # Permission is hereby granted, free of charge, to any person obtaining a | ||||||
| # copy of this software and associated documentation files (the "Software"), | # copy of this software and associated documentation files (the "Software"), | ||||||
|   | |||||||
							
								
								
									
										76
									
								
								Makefile.X11
									
									
									
									
									
								
							
							
						
						
									
										76
									
								
								Makefile.X11
									
									
									
									
									
								
							| @@ -1,9 +1,9 @@ | |||||||
| # $Id: Makefile.X11,v 1.69 2002/11/13 15:33:51 brianp Exp $ | # $Id: Makefile.X11,v 1.69.2.4 2003/03/11 15:34:29 brianp Exp $ | ||||||
|  |  | ||||||
| # Mesa 3-D graphics library | # Mesa 3-D graphics library | ||||||
| # Version:  5.0 | # Version:  5.0.1 | ||||||
| #  | #  | ||||||
| # Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | # Copyright (C) 1999-2003  Brian Paul   All Rights Reserved. | ||||||
| #  | #  | ||||||
| # Permission is hereby granted, free of charge, to any person obtaining a | # Permission is hereby granted, free of charge, to any person obtaining a | ||||||
| # copy of this software and associated documentation files (the "Software"), | # copy of this software and associated documentation files (the "Software"), | ||||||
| @@ -330,10 +330,10 @@ realclean: clean | |||||||
| 	cd samples     && $(MAKE) -f Makefile.X11 realclean || true | 	cd samples     && $(MAKE) -f Makefile.X11 realclean || true | ||||||
|  |  | ||||||
|  |  | ||||||
| DIRECTORY = Mesa-5.0 | DIRECTORY = Mesa-5.0.1 | ||||||
| LIB_NAME = MesaLib-5.0 | LIB_NAME = MesaLib-5.0.1 | ||||||
| DEMO_NAME = MesaDemos-5.0 | DEMO_NAME = MesaDemos-5.0.1 | ||||||
| GLU_NAME = MesaGLU-5.0 | GLU_NAME = MesaGLU-5.0.1 | ||||||
| GLUT_NAME = GLUT-3.7 | GLUT_NAME = GLUT-3.7 | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -429,7 +429,7 @@ LIB_FILES =	\ | |||||||
| 	$(DIRECTORY)/src/windml/man3/*.3				\ | 	$(DIRECTORY)/src/windml/man3/*.3				\ | ||||||
| 	$(DIRECTORY)/src/windml/man3/*.html				\ | 	$(DIRECTORY)/src/windml/man3/*.html				\ | ||||||
| 	$(DIRECTORY)/src/DOS/*.[chS]					\ | 	$(DIRECTORY)/src/DOS/*.[chS]					\ | ||||||
| 	$(DIRECTORY)/src/DOS/vesa/*.[ch]				\ | 	$(DIRECTORY)/src/DOS/mga/*.[ch]					\ | ||||||
| 	$(DIRECTORY)/src/BeOS/*.cpp					\ | 	$(DIRECTORY)/src/BeOS/*.cpp					\ | ||||||
| 	$(DIRECTORY)/src/FX/Makefile.am					\ | 	$(DIRECTORY)/src/FX/Makefile.am					\ | ||||||
| 	$(DIRECTORY)/src/FX/Makefile.in					\ | 	$(DIRECTORY)/src/FX/Makefile.in					\ | ||||||
| @@ -486,6 +486,7 @@ LIB_FILES =	\ | |||||||
| 	$(DIRECTORY)/si-glu/Makefile.in					\ | 	$(DIRECTORY)/si-glu/Makefile.in					\ | ||||||
| 	$(DIRECTORY)/si-glu/Makefile.X11				\ | 	$(DIRECTORY)/si-glu/Makefile.X11				\ | ||||||
| 	$(DIRECTORY)/si-glu/Makefile.win				\ | 	$(DIRECTORY)/si-glu/Makefile.win				\ | ||||||
|  | 	$(DIRECTORY)/si-glu/Makefile.DJ					\ | ||||||
| 	$(DIRECTORY)/si-glu/glu.def					\ | 	$(DIRECTORY)/si-glu/glu.def					\ | ||||||
| 	$(DIRECTORY)/si-glu/dummy.cc					\ | 	$(DIRECTORY)/si-glu/dummy.cc					\ | ||||||
| 	$(DIRECTORY)/si-glu/descrip.mms					\ | 	$(DIRECTORY)/si-glu/descrip.mms					\ | ||||||
| @@ -705,33 +706,31 @@ OBSOLETE_GLUT_FILES = \ | |||||||
| 	$(DIRECTORY)/src-glut.beos/*.h | 	$(DIRECTORY)/src-glut.beos/*.h | ||||||
|  |  | ||||||
|  |  | ||||||
| lib_tar: | lib_gz: | ||||||
| 	cp Makefile.X11 Makefile ; \ | 	cp Makefile.X11 Makefile ; \ | ||||||
| 	cd .. ; \ | 	cd .. ; \ | ||||||
| 	tar -cvf $(LIB_NAME).tar $(LIB_FILES) ; \ | 	tar -cvf $(LIB_NAME).tar $(LIB_FILES) ; \ | ||||||
| 	gzip $(LIB_NAME).tar ; \ | 	gzip $(LIB_NAME).tar ; \ | ||||||
| 	mv $(LIB_NAME).tar.gz $(DIRECTORY) | 	mv $(LIB_NAME).tar.gz $(DIRECTORY) | ||||||
|  |  | ||||||
| demo_tar: | demo_gz: | ||||||
| 	cd .. ; \ | 	cd .. ; \ | ||||||
| 	tar -cvf $(DEMO_NAME).tar $(DEMO_FILES) ; \ | 	tar -cvf $(DEMO_NAME).tar $(DEMO_FILES) ; \ | ||||||
| 	gzip $(DEMO_NAME).tar ; \ | 	gzip $(DEMO_NAME).tar ; \ | ||||||
| 	mv $(DEMO_NAME).tar.gz $(DIRECTORY) | 	mv $(DEMO_NAME).tar.gz $(DIRECTORY) | ||||||
|  |  | ||||||
| glu_tar: | lib_bz2: | ||||||
| 	cp Makefile.X11 Makefile ; \ | 	cp Makefile.X11 Makefile ; \ | ||||||
| 	cd .. ; \ | 	cd .. ; \ | ||||||
| 	tar -cvf $(GLU_NAME).tar $(GLU_FILES) ; \ | 	tar -cvf $(LIB_NAME).tar $(LIB_FILES) ; \ | ||||||
| 	gzip $(GLU_NAME).tar ; \ | 	bzip2 $(LIB_NAME).tar ; \ | ||||||
| 	mv $(GLU_NAME).tar.gz $(DIRECTORY) | 	mv $(LIB_NAME).tar.bz2 $(DIRECTORY) | ||||||
|  |  | ||||||
| glut_tar: | demo_bz2: | ||||||
| 	cp Makefile.X11 Makefile ; \ |  | ||||||
| 	cd .. ; \ | 	cd .. ; \ | ||||||
| 	tar -cvf $(GLUT_NAME).tar $(GLUT_FILES) ; \ | 	tar -cvf $(DEMO_NAME).tar $(DEMO_FILES) ; \ | ||||||
| 	gzip $(GLUT_NAME).tar ; \ | 	bzip2 $(DEMO_NAME).tar ; \ | ||||||
| 	mv $(GLUT_NAME).tar.gz $(DIRECTORY) | 	mv $(DEMO_NAME).tar.bz2 $(DIRECTORY) | ||||||
|  |  | ||||||
|  |  | ||||||
| lib_zip: | lib_zip: | ||||||
| 	-rm $(LIB_NAME).zip ; \ | 	-rm $(LIB_NAME).zip ; \ | ||||||
| @@ -746,20 +745,29 @@ demo_zip: | |||||||
| 	zip -r $(DEMO_NAME).zip $(DEMO_FILES) ; \ | 	zip -r $(DEMO_NAME).zip $(DEMO_FILES) ; \ | ||||||
| 	mv $(DEMO_NAME).zip $(DIRECTORY) | 	mv $(DEMO_NAME).zip $(DIRECTORY) | ||||||
|  |  | ||||||
|  | md5: | ||||||
|  | 	@-md5sum $(LIB_NAME).tar.gz | ||||||
|  | 	@-md5sum $(LIB_NAME).tar.bz2 | ||||||
|  | 	@-md5sum $(LIB_NAME).zip | ||||||
|  | 	@-md5sum $(DEMO_NAME).tar.gz | ||||||
|  | 	@-md5sum $(DEMO_NAME).tar.bz2 | ||||||
|  | 	@-md5sum $(DEMO_NAME).zip | ||||||
|  |  | ||||||
|  | # Everything for new Mesa release: | ||||||
|  | tarballs: lib_gz demo_gz lib_bz2 demo_bz2 lib_zip demo_zip md5 | ||||||
|  |  | ||||||
|  |  | ||||||
| SRC_FILES =	\ | # not used | ||||||
| 	RELNOTES		\ | glu_gz: | ||||||
| 	src/Makefile*		\ | 	cp Makefile.X11 Makefile ; \ | ||||||
| 	src/depend		\ | 	cd .. ; \ | ||||||
| 	src/*.[chS]		\ | 	tar -cvf $(GLU_NAME).tar $(GLU_FILES) ; \ | ||||||
| 	src/*/*.[ch]		\ | 	gzip $(GLU_NAME).tar ; \ | ||||||
| 	include/GL/*.h | 	mv $(GLU_NAME).tar.gz $(DIRECTORY) | ||||||
|  |  | ||||||
| srctar: | glut_gz: | ||||||
| 	tar -cvf src.tar $(SRC_FILES) ; \ | 	cp Makefile.X11 Makefile ; \ | ||||||
| 	gzip src.tar | 	cd .. ; \ | ||||||
|  | 	tar -cvf $(GLUT_NAME).tar $(GLUT_FILES) ; \ | ||||||
| srctar.zip: | 	gzip $(GLUT_NAME).tar ; \ | ||||||
| 	-rm src.zip | 	mv $(GLUT_NAME).tar.gz $(DIRECTORY) | ||||||
| 	zip -r src.zip $(SRC_FILES) ; \ |  | ||||||
|   | |||||||
							
								
								
									
										210
									
								
								docs/README.DJ
									
									
									
									
									
								
							
							
						
						
									
										210
									
								
								docs/README.DJ
									
									
									
									
									
								
							| @@ -1,12 +1,12 @@ | |||||||
| 			Mesa 4.1 DOS/DJGPP Port v1.2 | 			Mesa 5.0.1 DOS/DJGPP Port v1.3 | ||||||
| 			~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 			~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| Description: | Description: | ||||||
| ~~~~~~~~~~~~ | ~~~~~~~~~~~~ | ||||||
|  |  | ||||||
| Well, guess what... this is the DOS port of Mesa 4.1, for DJGPP fans... Whoa! | Well, guess what... this is the DOS port of Mesa 5.0.1, for DJGPP fans... Whoa! | ||||||
| The driver has its origins in ddsample.c, written by Brian Paul and found by me | The driver has its origins in ddsample.c, written by Brian Paul and found by me | ||||||
| in Mesa 3.4.2. | in Mesa 3.4.2. | ||||||
|  |  | ||||||
| @@ -32,20 +32,24 @@ Available options: | |||||||
|      Environment variables: |      Environment variables: | ||||||
| 	CPU		optimize for the given processor. | 	CPU		optimize for the given processor. | ||||||
| 			default = k6 | 			default = k6 | ||||||
| 	BIG_OPT=1	crazy optimizations; not very useful, though... | 	GLU=[src|si]	specify GLU directory; can be `src' (src-glu = Mesa) | ||||||
| 			default = no | 			or `si' (si-glu = SGI's GLU -- requires GNU/C++). | ||||||
| 	GLIDE		absolute path to Glide library; used with FX. | 			default = src | ||||||
|  | 	GLIDE		path to Glide3 SDK include files; used with FX. | ||||||
| 			default = $(TOP)/include/glide3 | 			default = $(TOP)/include/glide3 | ||||||
| 	FX=1		build for 3dfx Glide3; use it if you have the Glide | 	FX=1		build for 3dfx Glide3. Note that this disables | ||||||
| 			SDK (designed for your platform), and, of course, a | 			compilation of most DMesa code and requires fxMesa. | ||||||
| 			3dfx card... Note that this disables compilation of | 			As a consequence, you'll need the DJGPP Glide3 | ||||||
| 			actual DMesa code, as Glide does all the stuff! | 			library to build any application. | ||||||
|  | 			default = no | ||||||
|  | 	MATROX=1	build for Matrox Millennium I (MGA2064W) cards. | ||||||
|  | 			This is experimental and not intensively tested. | ||||||
| 			default = no | 			default = no | ||||||
| 	HAVE_X86=1	optimize for i386. | 	HAVE_X86=1	optimize for i386. | ||||||
| 			default = no | 			default = no | ||||||
| 	HAVE_MMX=1	MMX instructions; use only if you assembler/compiler | 	HAVE_MMX=1	allow MMX specializations, provided your assembler | ||||||
| 			supports MMX instruction set; backwards compatibility | 			supports MMX instruction set. However, the true CPU | ||||||
| 			with older processors is still preserved. | 			capabilities are checked at run-time to avoid crashes. | ||||||
| 			default = no | 			default = no | ||||||
| 	HAVE_SSE=1	(see HAVE_MMX) | 	HAVE_SSE=1	(see HAVE_MMX) | ||||||
| 			default = no | 			default = no | ||||||
| @@ -65,8 +69,9 @@ Available options: | |||||||
| Tested on: | Tested on: | ||||||
| 	CPU:		K6-2 (CXT) @500(412.5) MHz | 	CPU:		K6-2 (CXT) @500(412.5) MHz | ||||||
| 	Mainboard:	ViA Apollo VP2/97 w/ 128 MB SDRAM | 	Mainboard:	ViA Apollo VP2/97 w/ 128 MB SDRAM | ||||||
| 	Video card:	PowerColor Evil King3 (Voodoo3 3000) w/ 16384 kB SDRAM | 	Video card:	PowerColor EvilKing3 (Voodoo3 3000 PCI) w/ 16 MB SDRAM | ||||||
| 	DJGPP:		djdev 2.04 + gcc v3.2 + make v3.79.1 | 	DJGPP:		djdev 2.04 + gcc v3.2.2 + make v3.79.1 | ||||||
|  | 	OS:		DOS and Win9x | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -80,124 +85,135 @@ FAQ: | |||||||
|    A) You need LFN support. |    A) You need LFN support. | ||||||
|    A) When compiling for Glide (FX=1), pay attention to Glide path. |    A) When compiling for Glide (FX=1), pay attention to Glide path. | ||||||
|  |  | ||||||
| 2. Dynamic modules |    Q) Libraries built OK, but linker complains about `vsnprintf' every time I | ||||||
|  |       compile some demo. | ||||||
|  |    A) Upgrade to DJGPP 2.04. | ||||||
|  |    A) Add `vsnprintf.c' to the CORE_SOURCES in `src/Makefile.DJ' (untested!). | ||||||
|  |    A) The following hack should be safe in 90% of the cases, but if anything | ||||||
|  |       goes wrong, don't come back to me crying. Anyway, patch `src/imports.c' | ||||||
|  |       with the following line: | ||||||
|  | 	#define vsnprintf(buf, max, fmt, arg) vsprintf(buf, fmt, arg) | ||||||
|  |  | ||||||
|    Q) What are you mumbling about dynamic modules? |    Q) `make' complains about DXE3 or something, yet it builds the libraries. | ||||||
|    A) You must have the DXE2 package (available on SimTel.Net, courtesy of |    A) DXE3 refers to the DJGPP dynamic modules. You'll need either the latest | ||||||
|       Andrew Zabolotny) installed in order to build the dynamic modules. |       DJGPP distro, or download the separate package from my web page. Read the | ||||||
|  |       DXE3 documentation on how to use them. Hint: build your export object | ||||||
|  |       file; then link it with your application. For example: | ||||||
|  | 	dxe3res -o dxe3tbl.c gl.dxe glu.dxe glut.dxe | ||||||
|  | 	gcc -o dxe3tbl.o -c dxe3tbl.c | ||||||
|  | 	gcc -o OUT.exe dxe3tbl.o IN.c -liglut -liglu -ligl -ldl | ||||||
|  |  | ||||||
|    Q) I have DXE2, but I couldn't build the `dxe2gen.exe'. | 2. Using Mesa for DJGPP | ||||||
|    Q) I built `dxe2gen.exe', but it doesn't do the job right. |  | ||||||
|    A) There is a patched version on my web page. |  | ||||||
|  |  | ||||||
|    Q) DXE2 modules give me headaches... |    Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much better... | ||||||
|    A) The DXE2 modules are not compulsory. The static libraries are still built |    A) Is that a question? If you have a Voodoo3/Banshee card, you're lucky (the | ||||||
|       and you can use them in the old-fashioned, classic way... and learn to |       Glide port is on my web page). If you have a Matrox Millennium I card, | ||||||
|       live with your ~2MB executable size. For example: |       you just MIGHT be lucky... If you haven't, sorry; everything is done in | ||||||
| 	gcc -o OUT.exe IN.c -lglut -lglu -lgl |       software. Suggestions? | ||||||
|  |  | ||||||
|    Q) Okay, DXE2 modules are built. How can I use them? |    Q) I tried to set refresh rate w/ DMesa, but without success. | ||||||
|    A) Build your export object file; then link it with your application. |    A) Refresh rate control works only for VESA 3.0. If you were compiling for | ||||||
|       For example: |       Glide, see Glide info. If not, sorry! | ||||||
| 	dxe2res -o dmesadxe.c gl.dxe glu.dxe glut.dxe |  | ||||||
| 	gcc -o dmesadxe.o dmesadxe.c |  | ||||||
| 	gcc -o OUT.exe dmesadxe.o IN.c -liglut -liglu -ligl -ldl |  | ||||||
|  |  | ||||||
|    Q) What is that `dxe2res.exe' thing? |  | ||||||
|    A) That is an utility that generates the export file for a given set of |  | ||||||
|       modules. If you can't find it in the DXE2 package, you must be looking at |  | ||||||
|       the wrong archive :) |  | ||||||
|  |  | ||||||
| 3. Using Mesa for DJGPP |  | ||||||
|  |  | ||||||
|    Q) Does this build work in Win9x? |  | ||||||
|    A) Yes. |  | ||||||
|  |  | ||||||
|    Q) Does it work under NT (W2k, XP) core? |  | ||||||
|    A) Uh... probably not! |  | ||||||
|  |  | ||||||
|    Q) I made a simple application and it does nothing. It exits right away. Not |    Q) I made a simple application and it does nothing. It exits right away. Not | ||||||
|       even a blank screen. |       even a blank screen. | ||||||
|    A) The current version supports only RGB[A] modes, for it made no sense to |    A) The pure software drivers (VESA/VGA) support only double-buffered modes. | ||||||
|       me to endorse color-index (aka palette) modes. |    A) Another weird "feature" is that buffer width must be multiple of 8 (I'm a | ||||||
|    A) Single-buffered is not allowed at all. Until I can find a way to use |  | ||||||
|       *REAL* hardware acceleration, it won't get implemented. |  | ||||||
|    A) Another weird "feature" is that buffer width must be multiple of 4 (I'm a |  | ||||||
|       lazy programmer and I found that the easiest way to keep buffer handling |       lazy programmer and I found that the easiest way to keep buffer handling | ||||||
|       at peak performance ;-). |       at peak performance ;-). | ||||||
|  |  | ||||||
|    Q) My demo doesn't display text. I know I used the glut font routines! |    Q) My demo doesn't display text. I know I used the GLUT font routines! | ||||||
|    A) Then you probably use GLUT as a DXE. Well, there is no direct access to |    A) Then you probably use GLUT as a DXE. Well, there is no direct access to | ||||||
|       variables due to the way DXE works. Read the documentation. The author of |       variables due to the way DXE works. Read the documentation. The author of | ||||||
|       GLUT took this into account for _WIN32 DLL's only; I don't want to modify |       GLUT took this into account for _WIN32 DLL's only; I don't want to modify | ||||||
|       his headers. The only workaround is to link GLUT the old way :-( |       his headers. The only workaround is to link GLUT the old way :-( | ||||||
|  |  | ||||||
|    Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much |    Q) The GLUT is incomplete. | ||||||
|       better... |    A) See below. | ||||||
|    A) Is that a question? If you have a Voodoo3/Banshee card, you're lucky. The |  | ||||||
|       Glide port is on my web page. If you haven't, sorry; everything is done |  | ||||||
|       in software. Suggestions? |  | ||||||
|  |  | ||||||
|    Q) I have a super/mega/ultra monitor and all you can do is 60Hz? My eyes are |  | ||||||
|       leaking from the orbits... |  | ||||||
|    A) If you were compiling for Glide, see Glide info. If not, be aware that |  | ||||||
|       refresh rate control works only for VESA 3.0. The environment variable |  | ||||||
|       DMESA_REFRESH sets the default screen refresh. For example: |  | ||||||
| 	set DMESA_REFRESH=75 |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| libGLUT (the toolkit): | libGLUT (the toolkit): | ||||||
| ~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  |  | ||||||
| Well, this "skeletal" GLUT implementation is not mine. Thanks should go to | Well, this "skeletal" GLUT implementation was taken from AllegGL project and | ||||||
| Bernhard Tschirren, Mark Kilgard, Brian Paul and probably others (or probably | heavily changed. Thanks should go to Bernhard Tschirren, Mark Kilgard, Brian | ||||||
| not ;-). I only changed it to be self-standing (Allegro-free). The keyboard, | Paul and probably others (or probably not ;-). GLUT functionality will be | ||||||
| mouse and timer drivers were inspired from an old project of mine (D3Xl) and | extended only on an "as needed" basis. | ||||||
| fixed with many Allegro "infusions"; I deeply thank to Shawn Hargreaves et co. |  | ||||||
|  |  | ||||||
| My keyboard driver used only scancodes, but since GLUT requires ASCII values | GLUT talks to hardware via PC_HW package which was put together from various | ||||||
| for keys, I borrowed the translation tables (and maybe more) from Allegro. | pieces I wrote long time ago. It consists from the keyboard, mouse and timer | ||||||
| Ctrl-Alt-Del (plus Ctrl-Alt-End, for Windows users) will shut down the GLUT | drivers. | ||||||
| engine unconditionally: it will raise SIGINT, which in turn will call the |  | ||||||
| destructors (let's hope), thus cleaning up your/my mess ;-) NB: since the |  | ||||||
| DJGPP guys ensured signal handlers won't go beyond program's space (and since |  | ||||||
| dynamic modules shall) the SIGINT can't be hooked (well, it can, but it is |  | ||||||
| useless), therefore you must live with the 'Exiting due to signal SIGINT' |  | ||||||
| message... |  | ||||||
|  |  | ||||||
| The mouse driver is far from complete (lack of positioning, drawing, etc), | My keyboard driver used only scancodes; as GLUT requires ASCII values for keys, | ||||||
| but is enough to make almost all the demos work. | I borrowed the translation tables (and maybe more) from Allegro -- many thanks | ||||||
|  | to Shawn Hargreaves et co. Ctrl-Alt-Del (plus Ctrl-Alt-End, for Windows users) | ||||||
|  | will shut down the GLUT engine unconditionally: it will raise SIGINT, which in | ||||||
|  | turn will (hopefully) call the destructors, thus cleaning up your/my mess ;-) | ||||||
|  | NB: since the DJGPP guys ensured signal handlers won't go beyond program's | ||||||
|  | space (and since dynamic modules shall) the SIGINT can't be hooked (well, it | ||||||
|  | can, but it is useless), therefore you must live with the 'Exiting due to | ||||||
|  | signal SIGINT' message... | ||||||
|  |  | ||||||
|  | The mouse driver is far from complete (lack of drawing, etc), but is enough to | ||||||
|  | make almost all the demos work. Supports the CuteMouse WheelAPI. | ||||||
|  |  | ||||||
| The timer is pretty versatile for it supports multiple timers with different | The timer is pretty versatile for it supports multiple timers with different | ||||||
| frequencies. It may not be the most accurate timer in the known universe, but | frequencies. While not being the most accurate timer in the known universe, I | ||||||
| I think it's OK. Take this example: you have timer A with a very high rate, | think it's OK. Take this example: you have timer A with a very high rate, and | ||||||
| and then you have timer B with very low rate compared to A; now, A ticks OK, | then you have timer B with very low rate compared to A; now, A ticks OK, but | ||||||
| but timer B will probably loose precision! | timer B will probably loose precision! | ||||||
|  |  | ||||||
| As an addition, stdout and stderr are redirected and dumped upon exit. This | As an addition, stdout and stderr are redirected and dumped upon exit. This | ||||||
| means that printf can be safely called during graphics, but all messages come | means that `printf' can be safely called during graphics. A bit of a hack, I | ||||||
| in bulk! A bit of a hack, I know, but I think it's better than to miss them | know, because all messages come in bulk, but I think it's better than nothing. | ||||||
| at all. "Borrowed" from RHIDE (Robert Hoehne) or SETEDIT (Salvador Eduardo | "Borrowed" from LIBRHUTI (Robert Hoehne). | ||||||
| Tropea)... I'm not sure. |  | ||||||
|  |  | ||||||
| Window creating defaults: 640x480x16 at (0,0), 8-bit stencil, 16-bit accum. | Window creating defaults: 300x300x16 at (0,0), 16-bit depth, 16-bit accum, | ||||||
| However, the video mode is chosen in such a way that first window will fit. | 8-bit stencil. However, the video mode is chosen in such a way that first | ||||||
|  | window will fit. If you need high resolution with small windows, set initial | ||||||
|  | position far to the right (or way down); then you can move them back to any | ||||||
|  | position right before the main loop. | ||||||
|  |  | ||||||
|  | The following environment variables can customize GLUT behaviour: | ||||||
|  | 	DMESA_GLUT_REFRESH	- set vertical screen refresh rate (VESA3) | ||||||
|  | 	DMESA_GLUT_BPP		- set default bits per pixel (VGA needs 8) | ||||||
|  | 	GLUT_FPS		- print frames/second statistics to stderr | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| History: | History: | ||||||
| ~~~~~~~~ | ~~~~~~~~ | ||||||
|  |  | ||||||
| v1.0	mar-2002	initial release | v1.0 (mar-2002) | ||||||
|  | 	initial release | ||||||
|  |  | ||||||
| v1.1	sep-2002	+ added 3dfx Glide3 support | v1.1 (sep-2002) | ||||||
| 			+ added refresh rate control | 	+ added 3dfx Glide3 support | ||||||
| 			+ added fonts in glut | 	+ added refresh rate control | ||||||
| 			* lots of minor changes | 	+ added fonts in GLUT | ||||||
|  | 	* lots of minor changes | ||||||
|  |  | ||||||
| v1.2	nov-2002	* synced w/ Mesa-4.1 | v1.2 (nov-2002) | ||||||
| 			- removed dmesadxe.h | 	* synced w/ Mesa-4.1 | ||||||
|  | 	- removed dmesadxe.h | ||||||
|  |  | ||||||
|  | v1.3 (mar-2003) | ||||||
|  | 	+ enabled OpenGL 1.4 support | ||||||
|  | 	+ added MMX clear/blit routines | ||||||
|  | 	+ enabled SGI's GLU compilation | ||||||
|  | 	+ added samples makefile | ||||||
|  | 	+ added new GLUT functions | ||||||
|  | 	+ added color-index modes | ||||||
|  | 	+ added Matrox Millennium MGA2064W driver | ||||||
|  | 	+ added 8bit FakeColor (thanks to Neil Funk) | ||||||
|  | 	+ added VGA support (to keep Ben Decker happy) | ||||||
|  | 	! fixed some compilation errors (reported by Chan Kar Heng) | ||||||
|  | 	* optimized driver for faster callback access... yeah, right :) | ||||||
|  | 	* overhauled virtual buffer and internal video drivers | ||||||
|  | 	* better fxMesa integration | ||||||
|  | 	* revamped GLUT | ||||||
|  | 	* switched to DXE3 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										46
									
								
								docs/RELNOTES-5.0.1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								docs/RELNOTES-5.0.1
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | |||||||
|  |  | ||||||
|  |                            Mesa 5.0.1 release notes | ||||||
|  |  | ||||||
|  |                                March 30, 2003 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Introduction | ||||||
|  | ------------ | ||||||
|  |  | ||||||
|  | Mesa uses an even/odd version number scheme like the Linux kernel. | ||||||
|  | Even-numbered versions (such as 5.0.x) designate stable releases. | ||||||
|  | Odd-numbered versions (such as 4.1.x) designate new developmental releases. | ||||||
|  |  | ||||||
|  | Mesa 5.0.1 just fixes bugs found since the 5.0 release.  See the VERSIONS | ||||||
|  | file for details. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Device Driver Status | ||||||
|  | -------------------- | ||||||
|  |  | ||||||
|  | A number of Mesa's software drivers haven't been actively maintained for | ||||||
|  | some time.  We rely on volunteers to maintain many of these drivers. | ||||||
|  | Here's the current status of all included drivers: | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Driver			Status | ||||||
|  | ----------------------	--------------------- | ||||||
|  | XMesa (Xlib)		implements OpenGL 1.4 | ||||||
|  | OSMesa (off-screen)	implements OpenGL 1.4 | ||||||
|  | FX (3dfx Voodoo1/2)	implements OpenGL 1.3 | ||||||
|  | SVGA			implements OpenGL 1.3 | ||||||
|  | Wind River UGL		implements OpenGL 1.3 | ||||||
|  | Windows/Win32		implements OpenGL 1.4 | ||||||
|  | DJGPP			implements OpenGL 1.4 | ||||||
|  | GGI			implements OpenGL 1.3 | ||||||
|  | BeOS			implements OpenGL 1.4 | ||||||
|  | Allegro			needs updating | ||||||
|  | D3D			needs updating | ||||||
|  |  | ||||||
|  | Note: supporting OpenGL 1.4 (vs. 1.3 or 1.2) usually only requires that the | ||||||
|  | driver call the _mesa_enable_1_4_extensions() function. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ---------------------------------------------------------------------- | ||||||
|  | $Id: RELNOTES-5.0.1,v 1.1.2.4 2003/03/30 16:07:16 brianp Exp $ | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| $Id: VERSIONS,v 1.118 2002/11/13 15:33:50 brianp Exp $ | $Id: VERSIONS,v 1.118.2.25 2003/03/29 16:11:22 brianp Exp $ | ||||||
|  |  | ||||||
|  |  | ||||||
| Mesa Version History | Mesa Version History | ||||||
| @@ -1080,3 +1080,41 @@ Mesa Version History | |||||||
| 	- fixed one-bit error in point/line fragment Z calculation | 	- fixed one-bit error in point/line fragment Z calculation | ||||||
| 	- fixed potential segfault in fakeglx code | 	- fixed potential segfault in fakeglx code | ||||||
| 	- fixed color overflow problem in DOT3 texture env mode | 	- fixed color overflow problem in DOT3 texture env mode | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 5.0.1  March 30, 2003 | ||||||
|  |     New: | ||||||
|  | 	- DOS driver updates from Daniel Borca | ||||||
|  | 	- updated GL/gl_mangle.h file (Bill Hoffman) | ||||||
|  |     Bug fixes: | ||||||
|  | 	- auto mipmap generation for cube maps was broken (bug 641363) | ||||||
|  | 	- writing/clearing software alpha channels was unreliable | ||||||
|  | 	- minor compilation fixes for OS/2 (Evgeny Kotsuba) | ||||||
|  | 	- fixed some bad assertions found with shadowtex demo | ||||||
|  | 	- fixed error checking bug in glCopyTexSubImage2D (bug 659020) | ||||||
|  | 	- glRotate(angle, -x, 0, 0) was incorrect (bug 659677) | ||||||
|  | 	- fixed potential segfault in texture object validation (bug 659012) | ||||||
|  | 	- fixed some bogus code in _mesa_test_os_sse_exception_support (Linus) | ||||||
|  | 	- fix fog stride bug in tnl code for h/w drivers (Michel Danzer) | ||||||
|  | 	- fixed glActiveTexture / glMatrixMode(GL_TEXTURE) bug (#669080) | ||||||
|  | 	- glGet(GL_CURRENT_SECONDARY_COLOR) should return 4 values, not 3 | ||||||
|  | 	- fixed compilation problem on Solaris7/x86 (bug 536406) | ||||||
|  | 	- fixed prefetch bug in 3DNow! code (Felix Kuhling) | ||||||
|  | 	- fixed NeXT build problem (FABSF macro) | ||||||
|  | 	- glDrawPixels Z values when glPixelZoom!=1 were invalid (bug 687811) | ||||||
|  | 	- zoomed glDraw/CopyPixels with clipping sometimes failed (bug 689964) | ||||||
|  | 	- AA line and triangle Z values are now rounded, not truncated | ||||||
|  | 	- fixed color interpolation bug when GLchan==GLfloat (bug 694461) | ||||||
|  | 	- glArePrograms/TexturesResident() wasn't 100% correct (Jose Fonseca) | ||||||
|  | 	- fixed a minor GL_COLOR_MATERIAL bug | ||||||
|  | 	- NV vertex program EXP instruction was broken | ||||||
|  | 	- glColorMask misbehaved with X window / pixmap rendering | ||||||
|  | 	- fix autoconf/libtool GLU C++ linker problem on Linux (a total hack) | ||||||
|  | 	- attempt to fix GGI compilation problem when MesaDemos not present | ||||||
|  | 	- NV vertex program ARL-relative fetches didn't work | ||||||
|  |     Changes: | ||||||
|  | 	- use glPolygonOffset in gloss demo to avoid z-fighting artifacts | ||||||
|  | 	- updated winpos and pointblast demos to use ARB extensions | ||||||
|  | 	- disable SPARC normal transformation code (bug 673938) | ||||||
|  | 	- GLU fixes for OS/2 (Evgeny Kotsuba) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -42,6 +42,7 @@ Be warned, some of these files may be very out of date. | |||||||
|  |  | ||||||
| <H1>Release Notes</H1> | <H1>Release Notes</H1> | ||||||
| <UL> | <UL> | ||||||
|  | <LI><A HREF="RELNOTES-5.0.1">RELNOTES-5.0.1</A> | ||||||
| <LI><A HREF="RELNOTES-5.0">RELNOTES-5.0</A> | <LI><A HREF="RELNOTES-5.0">RELNOTES-5.0</A> | ||||||
| <LI><A HREF="RELNOTES-4.1">RELNOTES-4.1</A> | <LI><A HREF="RELNOTES-4.1">RELNOTES-4.1</A> | ||||||
| <LI><A HREF="RELNOTES-4.0.3">RELNOTES-4.0.3</A> | <LI><A HREF="RELNOTES-4.0.3">RELNOTES-4.0.3</A> | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * DOS/DJGPP device driver v1.2 for Mesa 4.1 |  * DOS/DJGPP device driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -37,6 +37,17 @@ | |||||||
| #define DMESA_MAJOR_VERSION 5 | #define DMESA_MAJOR_VERSION 5 | ||||||
| #define DMESA_MINOR_VERSION 0 | #define DMESA_MINOR_VERSION 0 | ||||||
|  |  | ||||||
|  | /* Sample Usage: | ||||||
|  |  * | ||||||
|  |  * 1. Call DMesaCreateVisual() to initialize graphics. | ||||||
|  |  * 2. Call DMesaCreateContext() to create a DMesa rendering context. | ||||||
|  |  * 3. Call DMesaCreateBuffer() to define the window. | ||||||
|  |  * 4. Call DMesaMakeCurrent() to bind the DMesaBuffer to a DMesaContext. | ||||||
|  |  * 5. Make gl* calls to render your graphics. | ||||||
|  |  * 6. Use DMesaSwapBuffers() when double buffering to swap front/back buffers. | ||||||
|  |  * 7. Before exiting, destroy DMesaBuffer, DMesaContext and DMesaVisual. | ||||||
|  |  */ | ||||||
|  |  | ||||||
| typedef struct dmesa_context *DMesaContext; | typedef struct dmesa_context *DMesaContext; | ||||||
| typedef struct dmesa_visual *DMesaVisual; | typedef struct dmesa_visual *DMesaVisual; | ||||||
| typedef struct dmesa_buffer *DMesaBuffer; | typedef struct dmesa_buffer *DMesaBuffer; | ||||||
| @@ -45,32 +56,89 @@ typedef struct dmesa_buffer *DMesaBuffer; | |||||||
| extern "C" { | extern "C" { | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| DMesaVisual DMesaCreateVisual (GLint width, GLint height, | /* | ||||||
|                                GLint colDepth, |  * Create a new Visual and set graphics mode. | ||||||
|                                GLboolean dbFlag, |  */ | ||||||
|                                GLint depthSize, | DMesaVisual DMesaCreateVisual (GLint width,        /* X res */ | ||||||
|                                GLint stencilSize, |                                GLint height,       /* Y res */ | ||||||
|                                GLint accumSize); |                                GLint colDepth,     /* BPP */ | ||||||
|  |                                GLint refresh,      /* refresh rate: 0=default */ | ||||||
|  |                                GLboolean dbFlag,   /* double-buffered */ | ||||||
|  |                                GLboolean rgbFlag,  /* RGB mode */ | ||||||
|  |                                GLboolean alphaFlag,/* alpha buffer requested */ | ||||||
|  |                                GLint depthSize,    /* requested bits/depth */ | ||||||
|  |                                GLint stencilSize,  /* requested bits/stencil */ | ||||||
|  |                                GLint accumSize);   /* requested bits/accum */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Destroy Visual and restore screen. | ||||||
|  |  */ | ||||||
| void DMesaDestroyVisual (DMesaVisual v); | void DMesaDestroyVisual (DMesaVisual v); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Create a new Context for rendering. | ||||||
|  |  */ | ||||||
|  | DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share); | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Destroy Context. | ||||||
|  |  */ | ||||||
|  | void DMesaDestroyContext (DMesaContext c); | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Return a handle to the current context. | ||||||
|  |  */ | ||||||
|  | DMesaContext DMesaGetCurrentContext (void); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Create a new Buffer (window). | ||||||
|  |  */ | ||||||
| DMesaBuffer DMesaCreateBuffer (DMesaVisual visual, | DMesaBuffer DMesaCreateBuffer (DMesaVisual visual, | ||||||
|                                GLint xpos, GLint ypos, |                                GLint xpos, GLint ypos, | ||||||
|                                GLint width, GLint height); |                                GLint width, GLint height); | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Destroy Buffer. | ||||||
|  |  */ | ||||||
| void DMesaDestroyBuffer (DMesaBuffer b); | void DMesaDestroyBuffer (DMesaBuffer b); | ||||||
|  |  | ||||||
| DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share); | /* | ||||||
|  |  * Swap the front and back buffers for the given Buffer. | ||||||
| void DMesaDestroyContext (DMesaContext c); |  * No action is taken if the buffer is not double buffered. | ||||||
|  |  */ | ||||||
| GLboolean DMesaViewport (DMesaBuffer b, | void DMesaSwapBuffers (DMesaBuffer b); | ||||||
|                          GLint xpos, GLint ypos, |  | ||||||
|                          GLint width, GLint height); |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Bind Buffer to Context and make the Context the current one. | ||||||
|  |  */ | ||||||
| GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b); | GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b); | ||||||
|  |  | ||||||
| void DMesaSwapBuffers (DMesaBuffer b); |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Move/Resize current Buffer. | ||||||
|  |  */ | ||||||
|  | GLboolean DMesaMoveBuffer (GLint xpos, GLint ypos); | ||||||
|  | GLboolean DMesaResizeBuffer (GLint width, GLint height); | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Set palette index, using normalized values. | ||||||
|  |  */ | ||||||
|  | void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue); | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DMesa state retrieval. | ||||||
|  |  */ | ||||||
|  | #define DMESA_GET_SCREEN_SIZE 0x0100 | ||||||
|  | #define DMESA_GET_DRIVER_CAPS 0x0200 | ||||||
|  |  | ||||||
|  | #define DMESA_DRIVER_SWDB_BIT 0x1 /* software double-buffered */ | ||||||
|  | #define DMESA_DRIVER_LLWO_BIT 0x2 /* lower-left window origin */ | ||||||
|  | int DMesaGetIntegerv (GLenum pname, GLint *params); | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| /* $Id: gl.h,v 1.72 2002/10/17 19:39:31 kschultz Exp $ */ | /* $Id: gl.h,v 1.72.2.1 2003/02/28 16:29:05 brianp Exp $ */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  4.1 |  * Version:  5.0.1 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  * copy of this software and associated documentation files (the "Software"), |  * copy of this software and associated documentation files (the "Software"), | ||||||
| @@ -2646,6 +2646,13 @@ GLAPI void GLAPIENTRY glTracePointerRangeMESA( const GLvoid* first, const GLvoid | |||||||
| #endif /* GL_APPLE_ycbcr_422 */ | #endif /* GL_APPLE_ycbcr_422 */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifndef GL_ATI_texture_env_combine3 | ||||||
|  | #define GL_ATI_texture_env_combine3 1 | ||||||
|  | #define GL_MODULATE_ADD_ATI               0x8744 | ||||||
|  | #define GL_MODULATE_SIGNED_ADD_ATI        0x8745 | ||||||
|  | #define GL_MODULATE_SUBTRACT_ATI          0x8746 | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
| /********************************************************************** | /********************************************************************** | ||||||
|  * Begin system-specific stuff |  * Begin system-specific stuff | ||||||
|   | |||||||
| @@ -1,15 +1,14 @@ | |||||||
| #if 0  /* $Id: gl_mangle.h,v 1.11 2002/01/18 14:55:40 brianp Exp $ */ | #if 0  /* $Id: gl_mangle.h,v 1.11.4.1 2003/02/04 02:29:45 brianp Exp $ */ | ||||||
| 	# DO NOT EDIT!!! - TO REGENERATE from gl.h, EXECUTE THIS FILE IN KORN SHELL and save the output | #define GL_MANGLE_C1 "DO NOT EDIT!!! - TO REGENERATE from gl.h, EXECUTE THIS FILE IN SHELL (/bin/sh) and save the output" | ||||||
| 	# This file is used to create GL function protypes and aliases for the function names | #define GL_MANGLE_C2 "This file is used to create GL function protypes and aliases for the function names" | ||||||
|  |  | ||||||
| 	files="gl.h glext.h" | 	files="gl.h glext.h" | ||||||
| 	#get regeneration header - copy everything in this file above the "REGENERATE_TO_END" line | #define GL_MANGLE_C3 "get regeneration header - copy everything in this file above the 'REGENERATE_TO_END' line" | ||||||
| 	awk 	'!done; /^\/\*REGENERATE_TO_END/ {done=1}' $0 | 	awk 	'!done; /^\/\*REGENERATE_TO_END/ {done=1}' $0 | ||||||
| 	echo "\n" | 	echo "" | ||||||
|  | #define GL_MANGLE_C4 get aliases | ||||||
| 	#get aliases |  | ||||||
| 	grep '^GLAPI' $files | sed -e 's/.*ENTRY gl\([^( ]*\).*$/#define gl\1		MANGLE(\1)/' | sort | uniq | 	grep '^GLAPI' $files | sed -e 's/.*ENTRY gl\([^( ]*\).*$/#define gl\1		MANGLE(\1)/' | sort | uniq | ||||||
| 	echo "\n#endif /* GL_MANGLE_H */" | 	echo "" | ||||||
|  | 	echo "#endif /* GL_MANGLE_H */" | ||||||
| 	exit | 	exit | ||||||
| #endif /* REGENERATION */ | #endif /* REGENERATION */ | ||||||
|  |  | ||||||
| @@ -34,8 +33,8 @@ | |||||||
|  |  | ||||||
| /*REGENERATE_TO_END-----------ALL LINES BELOW HERE GET REPLACED ON REGENERATION */ | /*REGENERATE_TO_END-----------ALL LINES BELOW HERE GET REPLACED ON REGENERATION */ | ||||||
|  |  | ||||||
|  |  | ||||||
| #define glAccum		MANGLE(Accum) | #define glAccum		MANGLE(Accum) | ||||||
|  | #define glActiveStencilFaceEXT		MANGLE(ActiveStencilFaceEXT) | ||||||
| #define glActiveTexture		MANGLE(ActiveTexture) | #define glActiveTexture		MANGLE(ActiveTexture) | ||||||
| #define glActiveTextureARB		MANGLE(ActiveTextureARB) | #define glActiveTextureARB		MANGLE(ActiveTextureARB) | ||||||
| #define glAlphaFragmentOp1ATI		MANGLE(AlphaFragmentOp1ATI) | #define glAlphaFragmentOp1ATI		MANGLE(AlphaFragmentOp1ATI) | ||||||
| @@ -52,11 +51,13 @@ | |||||||
| #define glAsyncMarkerSGIX		MANGLE(AsyncMarkerSGIX) | #define glAsyncMarkerSGIX		MANGLE(AsyncMarkerSGIX) | ||||||
| #define glBegin		MANGLE(Begin) | #define glBegin		MANGLE(Begin) | ||||||
| #define glBeginFragmentShaderATI		MANGLE(BeginFragmentShaderATI) | #define glBeginFragmentShaderATI		MANGLE(BeginFragmentShaderATI) | ||||||
|  | #define glBeginOcclusionQueryNV		MANGLE(BeginOcclusionQueryNV) | ||||||
| #define glBeginVertexShaderEXT		MANGLE(BeginVertexShaderEXT) | #define glBeginVertexShaderEXT		MANGLE(BeginVertexShaderEXT) | ||||||
| #define glBindFragmentShaderATI		MANGLE(BindFragmentShaderATI) | #define glBindFragmentShaderATI		MANGLE(BindFragmentShaderATI) | ||||||
| #define glBindLightParameterEXT		MANGLE(BindLightParameterEXT) | #define glBindLightParameterEXT		MANGLE(BindLightParameterEXT) | ||||||
| #define glBindMaterialParameterEXT		MANGLE(BindMaterialParameterEXT) | #define glBindMaterialParameterEXT		MANGLE(BindMaterialParameterEXT) | ||||||
| #define glBindParameterEXT		MANGLE(BindParameterEXT) | #define glBindParameterEXT		MANGLE(BindParameterEXT) | ||||||
|  | #define glBindProgramARB		MANGLE(BindProgramARB) | ||||||
| #define glBindProgramNV		MANGLE(BindProgramNV) | #define glBindProgramNV		MANGLE(BindProgramNV) | ||||||
| #define glBindTexGenParameterEXT		MANGLE(BindTexGenParameterEXT) | #define glBindTexGenParameterEXT		MANGLE(BindTexGenParameterEXT) | ||||||
| #define glBindTexture		MANGLE(BindTexture) | #define glBindTexture		MANGLE(BindTexture) | ||||||
| @@ -80,6 +81,7 @@ | |||||||
| #define glBlendEquation		MANGLE(BlendEquation) | #define glBlendEquation		MANGLE(BlendEquation) | ||||||
| #define glBlendEquationEXT		MANGLE(BlendEquationEXT) | #define glBlendEquationEXT		MANGLE(BlendEquationEXT) | ||||||
| #define glBlendFunc		MANGLE(BlendFunc) | #define glBlendFunc		MANGLE(BlendFunc) | ||||||
|  | #define glBlendFuncSeparate		MANGLE(BlendFuncSeparate) | ||||||
| #define glBlendFuncSeparateEXT		MANGLE(BlendFuncSeparateEXT) | #define glBlendFuncSeparateEXT		MANGLE(BlendFuncSeparateEXT) | ||||||
| #define glBlendFuncSeparateINGR		MANGLE(BlendFuncSeparateINGR) | #define glBlendFuncSeparateINGR		MANGLE(BlendFuncSeparateINGR) | ||||||
| #define glCallList		MANGLE(CallList) | #define glCallList		MANGLE(CallList) | ||||||
| @@ -92,7 +94,7 @@ | |||||||
| #define glClearStencil		MANGLE(ClearStencil) | #define glClearStencil		MANGLE(ClearStencil) | ||||||
| #define glClientActiveTexture		MANGLE(ClientActiveTexture) | #define glClientActiveTexture		MANGLE(ClientActiveTexture) | ||||||
| #define glClientActiveTextureARB		MANGLE(ClientActiveTextureARB) | #define glClientActiveTextureARB		MANGLE(ClientActiveTextureARB) | ||||||
| #define glClientActiveVertexStream		MANGLE(ClientActiveVertexStream) | #define glClientActiveVertexStreamATI		MANGLE(ClientActiveVertexStreamATI) | ||||||
| #define glClipPlane		MANGLE(ClipPlane) | #define glClipPlane		MANGLE(ClipPlane) | ||||||
| #define glColor3b		MANGLE(Color3b) | #define glColor3b		MANGLE(Color3b) | ||||||
| #define glColor3bv		MANGLE(Color3bv) | #define glColor3bv		MANGLE(Color3bv) | ||||||
| @@ -214,6 +216,8 @@ | |||||||
| #define glDeleteFragmentShaderATI		MANGLE(DeleteFragmentShaderATI) | #define glDeleteFragmentShaderATI		MANGLE(DeleteFragmentShaderATI) | ||||||
| #define glDeleteLists		MANGLE(DeleteLists) | #define glDeleteLists		MANGLE(DeleteLists) | ||||||
| #define glDeleteObjectBufferATI		MANGLE(DeleteObjectBufferATI) | #define glDeleteObjectBufferATI		MANGLE(DeleteObjectBufferATI) | ||||||
|  | #define glDeleteOcclusionQueriesNV		MANGLE(DeleteOcclusionQueriesNV) | ||||||
|  | #define glDeleteProgramsARB		MANGLE(DeleteProgramsARB) | ||||||
| #define glDeleteProgramsNV		MANGLE(DeleteProgramsNV) | #define glDeleteProgramsNV		MANGLE(DeleteProgramsNV) | ||||||
| #define glDeleteTextures		MANGLE(DeleteTextures) | #define glDeleteTextures		MANGLE(DeleteTextures) | ||||||
| #define glDeleteTexturesEXT		MANGLE(DeleteTexturesEXT) | #define glDeleteTexturesEXT		MANGLE(DeleteTexturesEXT) | ||||||
| @@ -226,11 +230,15 @@ | |||||||
| #define glDisableClientState		MANGLE(DisableClientState) | #define glDisableClientState		MANGLE(DisableClientState) | ||||||
| #define glDisableTraceMESA		MANGLE(DisableTraceMESA) | #define glDisableTraceMESA		MANGLE(DisableTraceMESA) | ||||||
| #define glDisableVariantClientStateEXT		MANGLE(DisableVariantClientStateEXT) | #define glDisableVariantClientStateEXT		MANGLE(DisableVariantClientStateEXT) | ||||||
|  | #define glDisableVertexAttribArrayARB		MANGLE(DisableVertexAttribArrayARB) | ||||||
| #define glDrawArrays		MANGLE(DrawArrays) | #define glDrawArrays		MANGLE(DrawArrays) | ||||||
| #define glDrawArraysEXT		MANGLE(DrawArraysEXT) | #define glDrawArraysEXT		MANGLE(DrawArraysEXT) | ||||||
| #define glDrawBuffer		MANGLE(DrawBuffer) | #define glDrawBuffer		MANGLE(DrawBuffer) | ||||||
|  | #define glDrawElementArrayATI		MANGLE(DrawElementArrayATI) | ||||||
| #define glDrawElements		MANGLE(DrawElements) | #define glDrawElements		MANGLE(DrawElements) | ||||||
|  | #define glDrawMeshArraysSUN		MANGLE(DrawMeshArraysSUN) | ||||||
| #define glDrawPixels		MANGLE(DrawPixels) | #define glDrawPixels		MANGLE(DrawPixels) | ||||||
|  | #define glDrawRangeElementArrayATI		MANGLE(DrawRangeElementArrayATI) | ||||||
| #define glDrawRangeElements		MANGLE(DrawRangeElements) | #define glDrawRangeElements		MANGLE(DrawRangeElements) | ||||||
| #define glDrawRangeElementsEXT		MANGLE(DrawRangeElementsEXT) | #define glDrawRangeElementsEXT		MANGLE(DrawRangeElementsEXT) | ||||||
| #define glEdgeFlag		MANGLE(EdgeFlag) | #define glEdgeFlag		MANGLE(EdgeFlag) | ||||||
| @@ -238,13 +246,16 @@ | |||||||
| #define glEdgeFlagPointerEXT		MANGLE(EdgeFlagPointerEXT) | #define glEdgeFlagPointerEXT		MANGLE(EdgeFlagPointerEXT) | ||||||
| #define glEdgeFlagPointerListIBM		MANGLE(EdgeFlagPointerListIBM) | #define glEdgeFlagPointerListIBM		MANGLE(EdgeFlagPointerListIBM) | ||||||
| #define glEdgeFlagv		MANGLE(EdgeFlagv) | #define glEdgeFlagv		MANGLE(EdgeFlagv) | ||||||
|  | #define glElementPointerATI		MANGLE(ElementPointerATI) | ||||||
| #define glEnable		MANGLE(Enable) | #define glEnable		MANGLE(Enable) | ||||||
| #define glEnableClientState		MANGLE(EnableClientState) | #define glEnableClientState		MANGLE(EnableClientState) | ||||||
| #define glEnableTraceMESA		MANGLE(EnableTraceMESA) | #define glEnableTraceMESA		MANGLE(EnableTraceMESA) | ||||||
| #define glEnableVariantClientStateEXT		MANGLE(EnableVariantClientStateEXT) | #define glEnableVariantClientStateEXT		MANGLE(EnableVariantClientStateEXT) | ||||||
|  | #define glEnableVertexAttribArrayARB		MANGLE(EnableVertexAttribArrayARB) | ||||||
| #define glEnd		MANGLE(End) | #define glEnd		MANGLE(End) | ||||||
| #define glEndFragmentShaderATI		MANGLE(EndFragmentShaderATI) | #define glEndFragmentShaderATI		MANGLE(EndFragmentShaderATI) | ||||||
| #define glEndList		MANGLE(EndList) | #define glEndList		MANGLE(EndList) | ||||||
|  | #define glEndOcclusionQueryNV		MANGLE(EndOcclusionQueryNV) | ||||||
| #define glEndTraceMESA		MANGLE(EndTraceMESA) | #define glEndTraceMESA		MANGLE(EndTraceMESA) | ||||||
| #define glEndVertexShaderEXT		MANGLE(EndVertexShaderEXT) | #define glEndVertexShaderEXT		MANGLE(EndVertexShaderEXT) | ||||||
| #define glEvalCoord1d		MANGLE(EvalCoord1d) | #define glEvalCoord1d		MANGLE(EvalCoord1d) | ||||||
| @@ -271,11 +282,16 @@ | |||||||
| #define glFlush		MANGLE(Flush) | #define glFlush		MANGLE(Flush) | ||||||
| #define glFlushRasterSGIX		MANGLE(FlushRasterSGIX) | #define glFlushRasterSGIX		MANGLE(FlushRasterSGIX) | ||||||
| #define glFlushVertexArrayRangeNV		MANGLE(FlushVertexArrayRangeNV) | #define glFlushVertexArrayRangeNV		MANGLE(FlushVertexArrayRangeNV) | ||||||
|  | #define glFogCoordPointer		MANGLE(FogCoordPointer) | ||||||
| #define glFogCoordPointerEXT		MANGLE(FogCoordPointerEXT) | #define glFogCoordPointerEXT		MANGLE(FogCoordPointerEXT) | ||||||
| #define glFogCoordPointerListIBM		MANGLE(FogCoordPointerListIBM) | #define glFogCoordPointerListIBM		MANGLE(FogCoordPointerListIBM) | ||||||
|  | #define glFogCoordd		MANGLE(FogCoordd) | ||||||
| #define glFogCoorddEXT		MANGLE(FogCoorddEXT) | #define glFogCoorddEXT		MANGLE(FogCoorddEXT) | ||||||
|  | #define glFogCoorddv		MANGLE(FogCoorddv) | ||||||
| #define glFogCoorddvEXT		MANGLE(FogCoorddvEXT) | #define glFogCoorddvEXT		MANGLE(FogCoorddvEXT) | ||||||
|  | #define glFogCoordf		MANGLE(FogCoordf) | ||||||
| #define glFogCoordfEXT		MANGLE(FogCoordfEXT) | #define glFogCoordfEXT		MANGLE(FogCoordfEXT) | ||||||
|  | #define glFogCoordfv		MANGLE(FogCoordfv) | ||||||
| #define glFogCoordfvEXT		MANGLE(FogCoordfvEXT) | #define glFogCoordfvEXT		MANGLE(FogCoordfvEXT) | ||||||
| #define glFogFuncSGIS		MANGLE(FogFuncSGIS) | #define glFogFuncSGIS		MANGLE(FogFuncSGIS) | ||||||
| #define glFogf		MANGLE(Fogf) | #define glFogf		MANGLE(Fogf) | ||||||
| @@ -302,6 +318,8 @@ | |||||||
| #define glGenFencesNV		MANGLE(GenFencesNV) | #define glGenFencesNV		MANGLE(GenFencesNV) | ||||||
| #define glGenFragmentShadersATI		MANGLE(GenFragmentShadersATI) | #define glGenFragmentShadersATI		MANGLE(GenFragmentShadersATI) | ||||||
| #define glGenLists		MANGLE(GenLists) | #define glGenLists		MANGLE(GenLists) | ||||||
|  | #define glGenOcclusionQueriesNV		MANGLE(GenOcclusionQueriesNV) | ||||||
|  | #define glGenProgramsARB		MANGLE(GenProgramsARB) | ||||||
| #define glGenProgramsNV		MANGLE(GenProgramsNV) | #define glGenProgramsNV		MANGLE(GenProgramsNV) | ||||||
| #define glGenSymbolsEXT		MANGLE(GenSymbolsEXT) | #define glGenSymbolsEXT		MANGLE(GenSymbolsEXT) | ||||||
| #define glGenTextures		MANGLE(GenTextures) | #define glGenTextures		MANGLE(GenTextures) | ||||||
| @@ -383,6 +401,8 @@ | |||||||
| #define glGetMinmaxParameterivEXT		MANGLE(GetMinmaxParameterivEXT) | #define glGetMinmaxParameterivEXT		MANGLE(GetMinmaxParameterivEXT) | ||||||
| #define glGetObjectBufferfvATI		MANGLE(GetObjectBufferfvATI) | #define glGetObjectBufferfvATI		MANGLE(GetObjectBufferfvATI) | ||||||
| #define glGetObjectBufferivATI		MANGLE(GetObjectBufferivATI) | #define glGetObjectBufferivATI		MANGLE(GetObjectBufferivATI) | ||||||
|  | #define glGetOcclusionQueryivNV		MANGLE(GetOcclusionQueryivNV) | ||||||
|  | #define glGetOcclusionQueryuivNV		MANGLE(GetOcclusionQueryuivNV) | ||||||
| #define glGetPixelMapfv		MANGLE(GetPixelMapfv) | #define glGetPixelMapfv		MANGLE(GetPixelMapfv) | ||||||
| #define glGetPixelMapuiv		MANGLE(GetPixelMapuiv) | #define glGetPixelMapuiv		MANGLE(GetPixelMapuiv) | ||||||
| #define glGetPixelMapusv		MANGLE(GetPixelMapusv) | #define glGetPixelMapusv		MANGLE(GetPixelMapusv) | ||||||
| @@ -391,9 +411,15 @@ | |||||||
| #define glGetPointerv		MANGLE(GetPointerv) | #define glGetPointerv		MANGLE(GetPointerv) | ||||||
| #define glGetPointervEXT		MANGLE(GetPointervEXT) | #define glGetPointervEXT		MANGLE(GetPointervEXT) | ||||||
| #define glGetPolygonStipple		MANGLE(GetPolygonStipple) | #define glGetPolygonStipple		MANGLE(GetPolygonStipple) | ||||||
|  | #define glGetProgramEnvParameterdvARB		MANGLE(GetProgramEnvParameterdvARB) | ||||||
|  | #define glGetProgramEnvParameterfvARB		MANGLE(GetProgramEnvParameterfvARB) | ||||||
|  | #define glGetProgramLocalParameterdvARB		MANGLE(GetProgramLocalParameterdvARB) | ||||||
|  | #define glGetProgramLocalParameterfvARB		MANGLE(GetProgramLocalParameterfvARB) | ||||||
| #define glGetProgramParameterdvNV		MANGLE(GetProgramParameterdvNV) | #define glGetProgramParameterdvNV		MANGLE(GetProgramParameterdvNV) | ||||||
| #define glGetProgramParameterfvNV		MANGLE(GetProgramParameterfvNV) | #define glGetProgramParameterfvNV		MANGLE(GetProgramParameterfvNV) | ||||||
|  | #define glGetProgramStringARB		MANGLE(GetProgramStringARB) | ||||||
| #define glGetProgramStringNV		MANGLE(GetProgramStringNV) | #define glGetProgramStringNV		MANGLE(GetProgramStringNV) | ||||||
|  | #define glGetProgramivARB		MANGLE(GetProgramivARB) | ||||||
| #define glGetProgramivNV		MANGLE(GetProgramivNV) | #define glGetProgramivNV		MANGLE(GetProgramivNV) | ||||||
| #define glGetSeparableFilter		MANGLE(GetSeparableFilter) | #define glGetSeparableFilter		MANGLE(GetSeparableFilter) | ||||||
| #define glGetSeparableFilterEXT		MANGLE(GetSeparableFilterEXT) | #define glGetSeparableFilterEXT		MANGLE(GetSeparableFilterEXT) | ||||||
| @@ -419,9 +445,13 @@ | |||||||
| #define glGetVariantFloatvEXT		MANGLE(GetVariantFloatvEXT) | #define glGetVariantFloatvEXT		MANGLE(GetVariantFloatvEXT) | ||||||
| #define glGetVariantIntegervEXT		MANGLE(GetVariantIntegervEXT) | #define glGetVariantIntegervEXT		MANGLE(GetVariantIntegervEXT) | ||||||
| #define glGetVariantPointervEXT		MANGLE(GetVariantPointervEXT) | #define glGetVariantPointervEXT		MANGLE(GetVariantPointervEXT) | ||||||
|  | #define glGetVertexAttribPointervARB		MANGLE(GetVertexAttribPointervARB) | ||||||
| #define glGetVertexAttribPointervNV		MANGLE(GetVertexAttribPointervNV) | #define glGetVertexAttribPointervNV		MANGLE(GetVertexAttribPointervNV) | ||||||
|  | #define glGetVertexAttribdvARB		MANGLE(GetVertexAttribdvARB) | ||||||
| #define glGetVertexAttribdvNV		MANGLE(GetVertexAttribdvNV) | #define glGetVertexAttribdvNV		MANGLE(GetVertexAttribdvNV) | ||||||
|  | #define glGetVertexAttribfvARB		MANGLE(GetVertexAttribfvARB) | ||||||
| #define glGetVertexAttribfvNV		MANGLE(GetVertexAttribfvNV) | #define glGetVertexAttribfvNV		MANGLE(GetVertexAttribfvNV) | ||||||
|  | #define glGetVertexAttribivARB		MANGLE(GetVertexAttribivARB) | ||||||
| #define glGetVertexAttribivNV		MANGLE(GetVertexAttribivNV) | #define glGetVertexAttribivNV		MANGLE(GetVertexAttribivNV) | ||||||
| #define glGlobalAlphaFactorbSUN		MANGLE(GlobalAlphaFactorbSUN) | #define glGlobalAlphaFactorbSUN		MANGLE(GlobalAlphaFactorbSUN) | ||||||
| #define glGlobalAlphaFactordSUN		MANGLE(GlobalAlphaFactordSUN) | #define glGlobalAlphaFactordSUN		MANGLE(GlobalAlphaFactordSUN) | ||||||
| @@ -465,6 +495,8 @@ | |||||||
| #define glIsFenceNV		MANGLE(IsFenceNV) | #define glIsFenceNV		MANGLE(IsFenceNV) | ||||||
| #define glIsList		MANGLE(IsList) | #define glIsList		MANGLE(IsList) | ||||||
| #define glIsObjectBufferATI		MANGLE(IsObjectBufferATI) | #define glIsObjectBufferATI		MANGLE(IsObjectBufferATI) | ||||||
|  | #define glIsOcclusionQueryNV		MANGLE(IsOcclusionQueryNV) | ||||||
|  | #define glIsProgramARB		MANGLE(IsProgramARB) | ||||||
| #define glIsProgramNV		MANGLE(IsProgramNV) | #define glIsProgramNV		MANGLE(IsProgramNV) | ||||||
| #define glIsTexture		MANGLE(IsTexture) | #define glIsTexture		MANGLE(IsTexture) | ||||||
| #define glIsTextureEXT		MANGLE(IsTextureEXT) | #define glIsTextureEXT		MANGLE(IsTextureEXT) | ||||||
| @@ -525,7 +557,9 @@ | |||||||
| #define glMultTransposeMatrixdARB		MANGLE(MultTransposeMatrixdARB) | #define glMultTransposeMatrixdARB		MANGLE(MultTransposeMatrixdARB) | ||||||
| #define glMultTransposeMatrixf		MANGLE(MultTransposeMatrixf) | #define glMultTransposeMatrixf		MANGLE(MultTransposeMatrixf) | ||||||
| #define glMultTransposeMatrixfARB		MANGLE(MultTransposeMatrixfARB) | #define glMultTransposeMatrixfARB		MANGLE(MultTransposeMatrixfARB) | ||||||
|  | #define glMultiDrawArrays		MANGLE(MultiDrawArrays) | ||||||
| #define glMultiDrawArraysEXT		MANGLE(MultiDrawArraysEXT) | #define glMultiDrawArraysEXT		MANGLE(MultiDrawArraysEXT) | ||||||
|  | #define glMultiDrawElements		MANGLE(MultiDrawElements) | ||||||
| #define glMultiDrawElementsEXT		MANGLE(MultiDrawElementsEXT) | #define glMultiDrawElementsEXT		MANGLE(MultiDrawElementsEXT) | ||||||
| #define glMultiModeDrawArraysIBM		MANGLE(MultiModeDrawArraysIBM) | #define glMultiModeDrawArraysIBM		MANGLE(MultiModeDrawArraysIBM) | ||||||
| #define glMultiModeDrawElementsIBM		MANGLE(MultiModeDrawElementsIBM) | #define glMultiModeDrawElementsIBM		MANGLE(MultiModeDrawElementsIBM) | ||||||
| @@ -612,16 +646,16 @@ | |||||||
| #define glNormalPointerEXT		MANGLE(NormalPointerEXT) | #define glNormalPointerEXT		MANGLE(NormalPointerEXT) | ||||||
| #define glNormalPointerListIBM		MANGLE(NormalPointerListIBM) | #define glNormalPointerListIBM		MANGLE(NormalPointerListIBM) | ||||||
| #define glNormalPointervINTEL		MANGLE(NormalPointervINTEL) | #define glNormalPointervINTEL		MANGLE(NormalPointervINTEL) | ||||||
| #define glNormalStream3b		MANGLE(NormalStream3b) | #define glNormalStream3bATI		MANGLE(NormalStream3bATI) | ||||||
| #define glNormalStream3bv		MANGLE(NormalStream3bv) | #define glNormalStream3bvATI		MANGLE(NormalStream3bvATI) | ||||||
| #define glNormalStream3d		MANGLE(NormalStream3d) | #define glNormalStream3dATI		MANGLE(NormalStream3dATI) | ||||||
| #define glNormalStream3dv		MANGLE(NormalStream3dv) | #define glNormalStream3dvATI		MANGLE(NormalStream3dvATI) | ||||||
| #define glNormalStream3f		MANGLE(NormalStream3f) | #define glNormalStream3fATI		MANGLE(NormalStream3fATI) | ||||||
| #define glNormalStream3fv		MANGLE(NormalStream3fv) | #define glNormalStream3fvATI		MANGLE(NormalStream3fvATI) | ||||||
| #define glNormalStream3i		MANGLE(NormalStream3i) | #define glNormalStream3iATI		MANGLE(NormalStream3iATI) | ||||||
| #define glNormalStream3iv		MANGLE(NormalStream3iv) | #define glNormalStream3ivATI		MANGLE(NormalStream3ivATI) | ||||||
| #define glNormalStream3s		MANGLE(NormalStream3s) | #define glNormalStream3sATI		MANGLE(NormalStream3sATI) | ||||||
| #define glNormalStream3sv		MANGLE(NormalStream3sv) | #define glNormalStream3svATI		MANGLE(NormalStream3svATI) | ||||||
| #define glOrtho		MANGLE(Ortho) | #define glOrtho		MANGLE(Ortho) | ||||||
| #define glPNTrianglesfATI		MANGLE(PNTrianglesfATI) | #define glPNTrianglesfATI		MANGLE(PNTrianglesfATI) | ||||||
| #define glPNTrianglesiATI		MANGLE(PNTrianglesiATI) | #define glPNTrianglesiATI		MANGLE(PNTrianglesiATI) | ||||||
| @@ -644,12 +678,18 @@ | |||||||
| #define glPixelTransformParameteriEXT		MANGLE(PixelTransformParameteriEXT) | #define glPixelTransformParameteriEXT		MANGLE(PixelTransformParameteriEXT) | ||||||
| #define glPixelTransformParameterivEXT		MANGLE(PixelTransformParameterivEXT) | #define glPixelTransformParameterivEXT		MANGLE(PixelTransformParameterivEXT) | ||||||
| #define glPixelZoom		MANGLE(PixelZoom) | #define glPixelZoom		MANGLE(PixelZoom) | ||||||
|  | #define glPointParameterf		MANGLE(PointParameterf) | ||||||
| #define glPointParameterfARB		MANGLE(PointParameterfARB) | #define glPointParameterfARB		MANGLE(PointParameterfARB) | ||||||
| #define glPointParameterfEXT		MANGLE(PointParameterfEXT) | #define glPointParameterfEXT		MANGLE(PointParameterfEXT) | ||||||
| #define glPointParameterfSGIS		MANGLE(PointParameterfSGIS) | #define glPointParameterfSGIS		MANGLE(PointParameterfSGIS) | ||||||
|  | #define glPointParameterfv		MANGLE(PointParameterfv) | ||||||
| #define glPointParameterfvARB		MANGLE(PointParameterfvARB) | #define glPointParameterfvARB		MANGLE(PointParameterfvARB) | ||||||
| #define glPointParameterfvEXT		MANGLE(PointParameterfvEXT) | #define glPointParameterfvEXT		MANGLE(PointParameterfvEXT) | ||||||
| #define glPointParameterfvSGIS		MANGLE(PointParameterfvSGIS) | #define glPointParameterfvSGIS		MANGLE(PointParameterfvSGIS) | ||||||
|  | #define glPointParameteri		MANGLE(PointParameteri) | ||||||
|  | #define glPointParameteriNV		MANGLE(PointParameteriNV) | ||||||
|  | #define glPointParameteriv		MANGLE(PointParameteriv) | ||||||
|  | #define glPointParameterivNV		MANGLE(PointParameterivNV) | ||||||
| #define glPointSize		MANGLE(PointSize) | #define glPointSize		MANGLE(PointSize) | ||||||
| #define glPollAsyncSGIX		MANGLE(PollAsyncSGIX) | #define glPollAsyncSGIX		MANGLE(PollAsyncSGIX) | ||||||
| #define glPollInstrumentsSGIX		MANGLE(PollInstrumentsSGIX) | #define glPollInstrumentsSGIX		MANGLE(PollInstrumentsSGIX) | ||||||
| @@ -663,12 +703,21 @@ | |||||||
| #define glPopName		MANGLE(PopName) | #define glPopName		MANGLE(PopName) | ||||||
| #define glPrioritizeTextures		MANGLE(PrioritizeTextures) | #define glPrioritizeTextures		MANGLE(PrioritizeTextures) | ||||||
| #define glPrioritizeTexturesEXT		MANGLE(PrioritizeTexturesEXT) | #define glPrioritizeTexturesEXT		MANGLE(PrioritizeTexturesEXT) | ||||||
|  | #define glProgramEnvParameter4dARB		MANGLE(ProgramEnvParameter4dARB) | ||||||
|  | #define glProgramEnvParameter4dvARB		MANGLE(ProgramEnvParameter4dvARB) | ||||||
|  | #define glProgramEnvParameter4fARB		MANGLE(ProgramEnvParameter4fARB) | ||||||
|  | #define glProgramEnvParameter4fvARB		MANGLE(ProgramEnvParameter4fvARB) | ||||||
|  | #define glProgramLocalParameter4dARB		MANGLE(ProgramLocalParameter4dARB) | ||||||
|  | #define glProgramLocalParameter4dvARB		MANGLE(ProgramLocalParameter4dvARB) | ||||||
|  | #define glProgramLocalParameter4fARB		MANGLE(ProgramLocalParameter4fARB) | ||||||
|  | #define glProgramLocalParameter4fvARB		MANGLE(ProgramLocalParameter4fvARB) | ||||||
| #define glProgramParameter4dNV		MANGLE(ProgramParameter4dNV) | #define glProgramParameter4dNV		MANGLE(ProgramParameter4dNV) | ||||||
| #define glProgramParameter4dvNV		MANGLE(ProgramParameter4dvNV) | #define glProgramParameter4dvNV		MANGLE(ProgramParameter4dvNV) | ||||||
| #define glProgramParameter4fNV		MANGLE(ProgramParameter4fNV) | #define glProgramParameter4fNV		MANGLE(ProgramParameter4fNV) | ||||||
| #define glProgramParameter4fvNV		MANGLE(ProgramParameter4fvNV) | #define glProgramParameter4fvNV		MANGLE(ProgramParameter4fvNV) | ||||||
| #define glProgramParameters4dvNV		MANGLE(ProgramParameters4dvNV) | #define glProgramParameters4dvNV		MANGLE(ProgramParameters4dvNV) | ||||||
| #define glProgramParameters4fvNV		MANGLE(ProgramParameters4fvNV) | #define glProgramParameters4fvNV		MANGLE(ProgramParameters4fvNV) | ||||||
|  | #define glProgramStringARB		MANGLE(ProgramStringARB) | ||||||
| #define glPushAttrib		MANGLE(PushAttrib) | #define glPushAttrib		MANGLE(PushAttrib) | ||||||
| #define glPushClientAttrib		MANGLE(PushClientAttrib) | #define glPushClientAttrib		MANGLE(PushClientAttrib) | ||||||
| #define glPushMatrix		MANGLE(PushMatrix) | #define glPushMatrix		MANGLE(PushMatrix) | ||||||
| @@ -746,28 +795,44 @@ | |||||||
| #define glSampleMapATI		MANGLE(SampleMapATI) | #define glSampleMapATI		MANGLE(SampleMapATI) | ||||||
| #define glSampleMaskEXT		MANGLE(SampleMaskEXT) | #define glSampleMaskEXT		MANGLE(SampleMaskEXT) | ||||||
| #define glSampleMaskSGIS		MANGLE(SampleMaskSGIS) | #define glSampleMaskSGIS		MANGLE(SampleMaskSGIS) | ||||||
| #define glSamplePass		MANGLE(SamplePass) |  | ||||||
| #define glSamplePatternEXT		MANGLE(SamplePatternEXT) | #define glSamplePatternEXT		MANGLE(SamplePatternEXT) | ||||||
| #define glSamplePatternSGIS		MANGLE(SamplePatternSGIS) | #define glSamplePatternSGIS		MANGLE(SamplePatternSGIS) | ||||||
| #define glScaled		MANGLE(Scaled) | #define glScaled		MANGLE(Scaled) | ||||||
| #define glScalef		MANGLE(Scalef) | #define glScalef		MANGLE(Scalef) | ||||||
| #define glScissor		MANGLE(Scissor) | #define glScissor		MANGLE(Scissor) | ||||||
|  | #define glSecondaryColor3b		MANGLE(SecondaryColor3b) | ||||||
| #define glSecondaryColor3bEXT		MANGLE(SecondaryColor3bEXT) | #define glSecondaryColor3bEXT		MANGLE(SecondaryColor3bEXT) | ||||||
|  | #define glSecondaryColor3bv		MANGLE(SecondaryColor3bv) | ||||||
| #define glSecondaryColor3bvEXT		MANGLE(SecondaryColor3bvEXT) | #define glSecondaryColor3bvEXT		MANGLE(SecondaryColor3bvEXT) | ||||||
|  | #define glSecondaryColor3d		MANGLE(SecondaryColor3d) | ||||||
| #define glSecondaryColor3dEXT		MANGLE(SecondaryColor3dEXT) | #define glSecondaryColor3dEXT		MANGLE(SecondaryColor3dEXT) | ||||||
|  | #define glSecondaryColor3dv		MANGLE(SecondaryColor3dv) | ||||||
| #define glSecondaryColor3dvEXT		MANGLE(SecondaryColor3dvEXT) | #define glSecondaryColor3dvEXT		MANGLE(SecondaryColor3dvEXT) | ||||||
|  | #define glSecondaryColor3f		MANGLE(SecondaryColor3f) | ||||||
| #define glSecondaryColor3fEXT		MANGLE(SecondaryColor3fEXT) | #define glSecondaryColor3fEXT		MANGLE(SecondaryColor3fEXT) | ||||||
|  | #define glSecondaryColor3fv		MANGLE(SecondaryColor3fv) | ||||||
| #define glSecondaryColor3fvEXT		MANGLE(SecondaryColor3fvEXT) | #define glSecondaryColor3fvEXT		MANGLE(SecondaryColor3fvEXT) | ||||||
|  | #define glSecondaryColor3i		MANGLE(SecondaryColor3i) | ||||||
| #define glSecondaryColor3iEXT		MANGLE(SecondaryColor3iEXT) | #define glSecondaryColor3iEXT		MANGLE(SecondaryColor3iEXT) | ||||||
|  | #define glSecondaryColor3iv		MANGLE(SecondaryColor3iv) | ||||||
| #define glSecondaryColor3ivEXT		MANGLE(SecondaryColor3ivEXT) | #define glSecondaryColor3ivEXT		MANGLE(SecondaryColor3ivEXT) | ||||||
|  | #define glSecondaryColor3s		MANGLE(SecondaryColor3s) | ||||||
| #define glSecondaryColor3sEXT		MANGLE(SecondaryColor3sEXT) | #define glSecondaryColor3sEXT		MANGLE(SecondaryColor3sEXT) | ||||||
|  | #define glSecondaryColor3sv		MANGLE(SecondaryColor3sv) | ||||||
| #define glSecondaryColor3svEXT		MANGLE(SecondaryColor3svEXT) | #define glSecondaryColor3svEXT		MANGLE(SecondaryColor3svEXT) | ||||||
|  | #define glSecondaryColor3ub		MANGLE(SecondaryColor3ub) | ||||||
| #define glSecondaryColor3ubEXT		MANGLE(SecondaryColor3ubEXT) | #define glSecondaryColor3ubEXT		MANGLE(SecondaryColor3ubEXT) | ||||||
|  | #define glSecondaryColor3ubv		MANGLE(SecondaryColor3ubv) | ||||||
| #define glSecondaryColor3ubvEXT		MANGLE(SecondaryColor3ubvEXT) | #define glSecondaryColor3ubvEXT		MANGLE(SecondaryColor3ubvEXT) | ||||||
|  | #define glSecondaryColor3ui		MANGLE(SecondaryColor3ui) | ||||||
| #define glSecondaryColor3uiEXT		MANGLE(SecondaryColor3uiEXT) | #define glSecondaryColor3uiEXT		MANGLE(SecondaryColor3uiEXT) | ||||||
|  | #define glSecondaryColor3uiv		MANGLE(SecondaryColor3uiv) | ||||||
| #define glSecondaryColor3uivEXT		MANGLE(SecondaryColor3uivEXT) | #define glSecondaryColor3uivEXT		MANGLE(SecondaryColor3uivEXT) | ||||||
|  | #define glSecondaryColor3us		MANGLE(SecondaryColor3us) | ||||||
| #define glSecondaryColor3usEXT		MANGLE(SecondaryColor3usEXT) | #define glSecondaryColor3usEXT		MANGLE(SecondaryColor3usEXT) | ||||||
|  | #define glSecondaryColor3usv		MANGLE(SecondaryColor3usv) | ||||||
| #define glSecondaryColor3usvEXT		MANGLE(SecondaryColor3usvEXT) | #define glSecondaryColor3usvEXT		MANGLE(SecondaryColor3usvEXT) | ||||||
|  | #define glSecondaryColorPointer		MANGLE(SecondaryColorPointer) | ||||||
| #define glSecondaryColorPointerEXT		MANGLE(SecondaryColorPointerEXT) | #define glSecondaryColorPointerEXT		MANGLE(SecondaryColorPointerEXT) | ||||||
| #define glSecondaryColorPointerListIBM		MANGLE(SecondaryColorPointerListIBM) | #define glSecondaryColorPointerListIBM		MANGLE(SecondaryColorPointerListIBM) | ||||||
| #define glSelectBuffer		MANGLE(SelectBuffer) | #define glSelectBuffer		MANGLE(SelectBuffer) | ||||||
| @@ -935,32 +1000,69 @@ | |||||||
| #define glVertex4s		MANGLE(Vertex4s) | #define glVertex4s		MANGLE(Vertex4s) | ||||||
| #define glVertex4sv		MANGLE(Vertex4sv) | #define glVertex4sv		MANGLE(Vertex4sv) | ||||||
| #define glVertexArrayRangeNV		MANGLE(VertexArrayRangeNV) | #define glVertexArrayRangeNV		MANGLE(VertexArrayRangeNV) | ||||||
|  | #define glVertexAttrib1dARB		MANGLE(VertexAttrib1dARB) | ||||||
| #define glVertexAttrib1dNV		MANGLE(VertexAttrib1dNV) | #define glVertexAttrib1dNV		MANGLE(VertexAttrib1dNV) | ||||||
|  | #define glVertexAttrib1dvARB		MANGLE(VertexAttrib1dvARB) | ||||||
| #define glVertexAttrib1dvNV		MANGLE(VertexAttrib1dvNV) | #define glVertexAttrib1dvNV		MANGLE(VertexAttrib1dvNV) | ||||||
|  | #define glVertexAttrib1fARB		MANGLE(VertexAttrib1fARB) | ||||||
| #define glVertexAttrib1fNV		MANGLE(VertexAttrib1fNV) | #define glVertexAttrib1fNV		MANGLE(VertexAttrib1fNV) | ||||||
|  | #define glVertexAttrib1fvARB		MANGLE(VertexAttrib1fvARB) | ||||||
| #define glVertexAttrib1fvNV		MANGLE(VertexAttrib1fvNV) | #define glVertexAttrib1fvNV		MANGLE(VertexAttrib1fvNV) | ||||||
|  | #define glVertexAttrib1sARB		MANGLE(VertexAttrib1sARB) | ||||||
| #define glVertexAttrib1sNV		MANGLE(VertexAttrib1sNV) | #define glVertexAttrib1sNV		MANGLE(VertexAttrib1sNV) | ||||||
|  | #define glVertexAttrib1svARB		MANGLE(VertexAttrib1svARB) | ||||||
| #define glVertexAttrib1svNV		MANGLE(VertexAttrib1svNV) | #define glVertexAttrib1svNV		MANGLE(VertexAttrib1svNV) | ||||||
|  | #define glVertexAttrib2dARB		MANGLE(VertexAttrib2dARB) | ||||||
| #define glVertexAttrib2dNV		MANGLE(VertexAttrib2dNV) | #define glVertexAttrib2dNV		MANGLE(VertexAttrib2dNV) | ||||||
|  | #define glVertexAttrib2dvARB		MANGLE(VertexAttrib2dvARB) | ||||||
| #define glVertexAttrib2dvNV		MANGLE(VertexAttrib2dvNV) | #define glVertexAttrib2dvNV		MANGLE(VertexAttrib2dvNV) | ||||||
|  | #define glVertexAttrib2fARB		MANGLE(VertexAttrib2fARB) | ||||||
| #define glVertexAttrib2fNV		MANGLE(VertexAttrib2fNV) | #define glVertexAttrib2fNV		MANGLE(VertexAttrib2fNV) | ||||||
|  | #define glVertexAttrib2fvARB		MANGLE(VertexAttrib2fvARB) | ||||||
| #define glVertexAttrib2fvNV		MANGLE(VertexAttrib2fvNV) | #define glVertexAttrib2fvNV		MANGLE(VertexAttrib2fvNV) | ||||||
|  | #define glVertexAttrib2sARB		MANGLE(VertexAttrib2sARB) | ||||||
| #define glVertexAttrib2sNV		MANGLE(VertexAttrib2sNV) | #define glVertexAttrib2sNV		MANGLE(VertexAttrib2sNV) | ||||||
|  | #define glVertexAttrib2svARB		MANGLE(VertexAttrib2svARB) | ||||||
| #define glVertexAttrib2svNV		MANGLE(VertexAttrib2svNV) | #define glVertexAttrib2svNV		MANGLE(VertexAttrib2svNV) | ||||||
|  | #define glVertexAttrib3dARB		MANGLE(VertexAttrib3dARB) | ||||||
| #define glVertexAttrib3dNV		MANGLE(VertexAttrib3dNV) | #define glVertexAttrib3dNV		MANGLE(VertexAttrib3dNV) | ||||||
|  | #define glVertexAttrib3dvARB		MANGLE(VertexAttrib3dvARB) | ||||||
| #define glVertexAttrib3dvNV		MANGLE(VertexAttrib3dvNV) | #define glVertexAttrib3dvNV		MANGLE(VertexAttrib3dvNV) | ||||||
|  | #define glVertexAttrib3fARB		MANGLE(VertexAttrib3fARB) | ||||||
| #define glVertexAttrib3fNV		MANGLE(VertexAttrib3fNV) | #define glVertexAttrib3fNV		MANGLE(VertexAttrib3fNV) | ||||||
|  | #define glVertexAttrib3fvARB		MANGLE(VertexAttrib3fvARB) | ||||||
| #define glVertexAttrib3fvNV		MANGLE(VertexAttrib3fvNV) | #define glVertexAttrib3fvNV		MANGLE(VertexAttrib3fvNV) | ||||||
|  | #define glVertexAttrib3sARB		MANGLE(VertexAttrib3sARB) | ||||||
| #define glVertexAttrib3sNV		MANGLE(VertexAttrib3sNV) | #define glVertexAttrib3sNV		MANGLE(VertexAttrib3sNV) | ||||||
|  | #define glVertexAttrib3svARB		MANGLE(VertexAttrib3svARB) | ||||||
| #define glVertexAttrib3svNV		MANGLE(VertexAttrib3svNV) | #define glVertexAttrib3svNV		MANGLE(VertexAttrib3svNV) | ||||||
|  | #define glVertexAttrib4NbvARB		MANGLE(VertexAttrib4NbvARB) | ||||||
|  | #define glVertexAttrib4NivARB		MANGLE(VertexAttrib4NivARB) | ||||||
|  | #define glVertexAttrib4NsvARB		MANGLE(VertexAttrib4NsvARB) | ||||||
|  | #define glVertexAttrib4NubARB		MANGLE(VertexAttrib4NubARB) | ||||||
|  | #define glVertexAttrib4NubvARB		MANGLE(VertexAttrib4NubvARB) | ||||||
|  | #define glVertexAttrib4NuivARB		MANGLE(VertexAttrib4NuivARB) | ||||||
|  | #define glVertexAttrib4NusvARB		MANGLE(VertexAttrib4NusvARB) | ||||||
|  | #define glVertexAttrib4bvARB		MANGLE(VertexAttrib4bvARB) | ||||||
|  | #define glVertexAttrib4dARB		MANGLE(VertexAttrib4dARB) | ||||||
| #define glVertexAttrib4dNV		MANGLE(VertexAttrib4dNV) | #define glVertexAttrib4dNV		MANGLE(VertexAttrib4dNV) | ||||||
|  | #define glVertexAttrib4dvARB		MANGLE(VertexAttrib4dvARB) | ||||||
| #define glVertexAttrib4dvNV		MANGLE(VertexAttrib4dvNV) | #define glVertexAttrib4dvNV		MANGLE(VertexAttrib4dvNV) | ||||||
|  | #define glVertexAttrib4fARB		MANGLE(VertexAttrib4fARB) | ||||||
| #define glVertexAttrib4fNV		MANGLE(VertexAttrib4fNV) | #define glVertexAttrib4fNV		MANGLE(VertexAttrib4fNV) | ||||||
|  | #define glVertexAttrib4fvARB		MANGLE(VertexAttrib4fvARB) | ||||||
| #define glVertexAttrib4fvNV		MANGLE(VertexAttrib4fvNV) | #define glVertexAttrib4fvNV		MANGLE(VertexAttrib4fvNV) | ||||||
|  | #define glVertexAttrib4ivARB		MANGLE(VertexAttrib4ivARB) | ||||||
|  | #define glVertexAttrib4sARB		MANGLE(VertexAttrib4sARB) | ||||||
| #define glVertexAttrib4sNV		MANGLE(VertexAttrib4sNV) | #define glVertexAttrib4sNV		MANGLE(VertexAttrib4sNV) | ||||||
|  | #define glVertexAttrib4svARB		MANGLE(VertexAttrib4svARB) | ||||||
| #define glVertexAttrib4svNV		MANGLE(VertexAttrib4svNV) | #define glVertexAttrib4svNV		MANGLE(VertexAttrib4svNV) | ||||||
| #define glVertexAttrib4ubNV		MANGLE(VertexAttrib4ubNV) | #define glVertexAttrib4ubNV		MANGLE(VertexAttrib4ubNV) | ||||||
|  | #define glVertexAttrib4ubvARB		MANGLE(VertexAttrib4ubvARB) | ||||||
| #define glVertexAttrib4ubvNV		MANGLE(VertexAttrib4ubvNV) | #define glVertexAttrib4ubvNV		MANGLE(VertexAttrib4ubvNV) | ||||||
|  | #define glVertexAttrib4uivARB		MANGLE(VertexAttrib4uivARB) | ||||||
|  | #define glVertexAttrib4usvARB		MANGLE(VertexAttrib4usvARB) | ||||||
|  | #define glVertexAttribPointerARB		MANGLE(VertexAttribPointerARB) | ||||||
| #define glVertexAttribPointerNV		MANGLE(VertexAttribPointerNV) | #define glVertexAttribPointerNV		MANGLE(VertexAttribPointerNV) | ||||||
| #define glVertexAttribs1dvNV		MANGLE(VertexAttribs1dvNV) | #define glVertexAttribs1dvNV		MANGLE(VertexAttribs1dvNV) | ||||||
| #define glVertexAttribs1fvNV		MANGLE(VertexAttribs1fvNV) | #define glVertexAttribs1fvNV		MANGLE(VertexAttribs1fvNV) | ||||||
| @@ -976,44 +1078,44 @@ | |||||||
| #define glVertexAttribs4svNV		MANGLE(VertexAttribs4svNV) | #define glVertexAttribs4svNV		MANGLE(VertexAttribs4svNV) | ||||||
| #define glVertexAttribs4ubvNV		MANGLE(VertexAttribs4ubvNV) | #define glVertexAttribs4ubvNV		MANGLE(VertexAttribs4ubvNV) | ||||||
| #define glVertexBlendARB		MANGLE(VertexBlendARB) | #define glVertexBlendARB		MANGLE(VertexBlendARB) | ||||||
| #define glVertexBlendEnvf		MANGLE(VertexBlendEnvf) | #define glVertexBlendEnvfATI		MANGLE(VertexBlendEnvfATI) | ||||||
| #define glVertexBlendEnvi		MANGLE(VertexBlendEnvi) | #define glVertexBlendEnviATI		MANGLE(VertexBlendEnviATI) | ||||||
| #define glVertexPointer		MANGLE(VertexPointer) | #define glVertexPointer		MANGLE(VertexPointer) | ||||||
| #define glVertexPointerEXT		MANGLE(VertexPointerEXT) | #define glVertexPointerEXT		MANGLE(VertexPointerEXT) | ||||||
| #define glVertexPointerListIBM		MANGLE(VertexPointerListIBM) | #define glVertexPointerListIBM		MANGLE(VertexPointerListIBM) | ||||||
| #define glVertexPointervINTEL		MANGLE(VertexPointervINTEL) | #define glVertexPointervINTEL		MANGLE(VertexPointervINTEL) | ||||||
| #define glVertexStream1d		MANGLE(VertexStream1d) | #define glVertexStream1dATI		MANGLE(VertexStream1dATI) | ||||||
| #define glVertexStream1dv		MANGLE(VertexStream1dv) | #define glVertexStream1dvATI		MANGLE(VertexStream1dvATI) | ||||||
| #define glVertexStream1f		MANGLE(VertexStream1f) | #define glVertexStream1fATI		MANGLE(VertexStream1fATI) | ||||||
| #define glVertexStream1fv		MANGLE(VertexStream1fv) | #define glVertexStream1fvATI		MANGLE(VertexStream1fvATI) | ||||||
| #define glVertexStream1i		MANGLE(VertexStream1i) | #define glVertexStream1iATI		MANGLE(VertexStream1iATI) | ||||||
| #define glVertexStream1iv		MANGLE(VertexStream1iv) | #define glVertexStream1ivATI		MANGLE(VertexStream1ivATI) | ||||||
| #define glVertexStream1s		MANGLE(VertexStream1s) | #define glVertexStream1sATI		MANGLE(VertexStream1sATI) | ||||||
| #define glVertexStream1sv		MANGLE(VertexStream1sv) | #define glVertexStream1svATI		MANGLE(VertexStream1svATI) | ||||||
| #define glVertexStream2d		MANGLE(VertexStream2d) | #define glVertexStream2dATI		MANGLE(VertexStream2dATI) | ||||||
| #define glVertexStream2dv		MANGLE(VertexStream2dv) | #define glVertexStream2dvATI		MANGLE(VertexStream2dvATI) | ||||||
| #define glVertexStream2f		MANGLE(VertexStream2f) | #define glVertexStream2fATI		MANGLE(VertexStream2fATI) | ||||||
| #define glVertexStream2fv		MANGLE(VertexStream2fv) | #define glVertexStream2fvATI		MANGLE(VertexStream2fvATI) | ||||||
| #define glVertexStream2i		MANGLE(VertexStream2i) | #define glVertexStream2iATI		MANGLE(VertexStream2iATI) | ||||||
| #define glVertexStream2iv		MANGLE(VertexStream2iv) | #define glVertexStream2ivATI		MANGLE(VertexStream2ivATI) | ||||||
| #define glVertexStream2s		MANGLE(VertexStream2s) | #define glVertexStream2sATI		MANGLE(VertexStream2sATI) | ||||||
| #define glVertexStream2sv		MANGLE(VertexStream2sv) | #define glVertexStream2svATI		MANGLE(VertexStream2svATI) | ||||||
| #define glVertexStream3d		MANGLE(VertexStream3d) | #define glVertexStream3dATI		MANGLE(VertexStream3dATI) | ||||||
| #define glVertexStream3dv		MANGLE(VertexStream3dv) | #define glVertexStream3dvATI		MANGLE(VertexStream3dvATI) | ||||||
| #define glVertexStream3f		MANGLE(VertexStream3f) | #define glVertexStream3fATI		MANGLE(VertexStream3fATI) | ||||||
| #define glVertexStream3fv		MANGLE(VertexStream3fv) | #define glVertexStream3fvATI		MANGLE(VertexStream3fvATI) | ||||||
| #define glVertexStream3i		MANGLE(VertexStream3i) | #define glVertexStream3iATI		MANGLE(VertexStream3iATI) | ||||||
| #define glVertexStream3iv		MANGLE(VertexStream3iv) | #define glVertexStream3ivATI		MANGLE(VertexStream3ivATI) | ||||||
| #define glVertexStream3s		MANGLE(VertexStream3s) | #define glVertexStream3sATI		MANGLE(VertexStream3sATI) | ||||||
| #define glVertexStream3sv		MANGLE(VertexStream3sv) | #define glVertexStream3svATI		MANGLE(VertexStream3svATI) | ||||||
| #define glVertexStream4d		MANGLE(VertexStream4d) | #define glVertexStream4dATI		MANGLE(VertexStream4dATI) | ||||||
| #define glVertexStream4dv		MANGLE(VertexStream4dv) | #define glVertexStream4dvATI		MANGLE(VertexStream4dvATI) | ||||||
| #define glVertexStream4f		MANGLE(VertexStream4f) | #define glVertexStream4fATI		MANGLE(VertexStream4fATI) | ||||||
| #define glVertexStream4fv		MANGLE(VertexStream4fv) | #define glVertexStream4fvATI		MANGLE(VertexStream4fvATI) | ||||||
| #define glVertexStream4i		MANGLE(VertexStream4i) | #define glVertexStream4iATI		MANGLE(VertexStream4iATI) | ||||||
| #define glVertexStream4iv		MANGLE(VertexStream4iv) | #define glVertexStream4ivATI		MANGLE(VertexStream4ivATI) | ||||||
| #define glVertexStream4s		MANGLE(VertexStream4s) | #define glVertexStream4sATI		MANGLE(VertexStream4sATI) | ||||||
| #define glVertexStream4sv		MANGLE(VertexStream4sv) | #define glVertexStream4svATI		MANGLE(VertexStream4svATI) | ||||||
| #define glVertexWeightPointerEXT		MANGLE(VertexWeightPointerEXT) | #define glVertexWeightPointerEXT		MANGLE(VertexWeightPointerEXT) | ||||||
| #define glVertexWeightfEXT		MANGLE(VertexWeightfEXT) | #define glVertexWeightfEXT		MANGLE(VertexWeightfEXT) | ||||||
| #define glVertexWeightfvEXT		MANGLE(VertexWeightfvEXT) | #define glVertexWeightfvEXT		MANGLE(VertexWeightfvEXT) | ||||||
| @@ -1027,21 +1129,53 @@ | |||||||
| #define glWeightubvARB		MANGLE(WeightubvARB) | #define glWeightubvARB		MANGLE(WeightubvARB) | ||||||
| #define glWeightuivARB		MANGLE(WeightuivARB) | #define glWeightuivARB		MANGLE(WeightuivARB) | ||||||
| #define glWeightusvARB		MANGLE(WeightusvARB) | #define glWeightusvARB		MANGLE(WeightusvARB) | ||||||
|  | #define glWindowPos2d		MANGLE(WindowPos2d) | ||||||
|  | #define glWindowPos2dARB		MANGLE(WindowPos2dARB) | ||||||
| #define glWindowPos2dMESA		MANGLE(WindowPos2dMESA) | #define glWindowPos2dMESA		MANGLE(WindowPos2dMESA) | ||||||
|  | #define glWindowPos2dv		MANGLE(WindowPos2dv) | ||||||
|  | #define glWindowPos2dvARB		MANGLE(WindowPos2dvARB) | ||||||
| #define glWindowPos2dvMESA		MANGLE(WindowPos2dvMESA) | #define glWindowPos2dvMESA		MANGLE(WindowPos2dvMESA) | ||||||
|  | #define glWindowPos2f		MANGLE(WindowPos2f) | ||||||
|  | #define glWindowPos2fARB		MANGLE(WindowPos2fARB) | ||||||
| #define glWindowPos2fMESA		MANGLE(WindowPos2fMESA) | #define glWindowPos2fMESA		MANGLE(WindowPos2fMESA) | ||||||
|  | #define glWindowPos2fv		MANGLE(WindowPos2fv) | ||||||
|  | #define glWindowPos2fvARB		MANGLE(WindowPos2fvARB) | ||||||
| #define glWindowPos2fvMESA		MANGLE(WindowPos2fvMESA) | #define glWindowPos2fvMESA		MANGLE(WindowPos2fvMESA) | ||||||
|  | #define glWindowPos2i		MANGLE(WindowPos2i) | ||||||
|  | #define glWindowPos2iARB		MANGLE(WindowPos2iARB) | ||||||
| #define glWindowPos2iMESA		MANGLE(WindowPos2iMESA) | #define glWindowPos2iMESA		MANGLE(WindowPos2iMESA) | ||||||
|  | #define glWindowPos2iv		MANGLE(WindowPos2iv) | ||||||
|  | #define glWindowPos2ivARB		MANGLE(WindowPos2ivARB) | ||||||
| #define glWindowPos2ivMESA		MANGLE(WindowPos2ivMESA) | #define glWindowPos2ivMESA		MANGLE(WindowPos2ivMESA) | ||||||
|  | #define glWindowPos2s		MANGLE(WindowPos2s) | ||||||
|  | #define glWindowPos2sARB		MANGLE(WindowPos2sARB) | ||||||
| #define glWindowPos2sMESA		MANGLE(WindowPos2sMESA) | #define glWindowPos2sMESA		MANGLE(WindowPos2sMESA) | ||||||
|  | #define glWindowPos2sv		MANGLE(WindowPos2sv) | ||||||
|  | #define glWindowPos2svARB		MANGLE(WindowPos2svARB) | ||||||
| #define glWindowPos2svMESA		MANGLE(WindowPos2svMESA) | #define glWindowPos2svMESA		MANGLE(WindowPos2svMESA) | ||||||
|  | #define glWindowPos3d		MANGLE(WindowPos3d) | ||||||
|  | #define glWindowPos3dARB		MANGLE(WindowPos3dARB) | ||||||
| #define glWindowPos3dMESA		MANGLE(WindowPos3dMESA) | #define glWindowPos3dMESA		MANGLE(WindowPos3dMESA) | ||||||
|  | #define glWindowPos3dv		MANGLE(WindowPos3dv) | ||||||
|  | #define glWindowPos3dvARB		MANGLE(WindowPos3dvARB) | ||||||
| #define glWindowPos3dvMESA		MANGLE(WindowPos3dvMESA) | #define glWindowPos3dvMESA		MANGLE(WindowPos3dvMESA) | ||||||
|  | #define glWindowPos3f		MANGLE(WindowPos3f) | ||||||
|  | #define glWindowPos3fARB		MANGLE(WindowPos3fARB) | ||||||
| #define glWindowPos3fMESA		MANGLE(WindowPos3fMESA) | #define glWindowPos3fMESA		MANGLE(WindowPos3fMESA) | ||||||
|  | #define glWindowPos3fv		MANGLE(WindowPos3fv) | ||||||
|  | #define glWindowPos3fvARB		MANGLE(WindowPos3fvARB) | ||||||
| #define glWindowPos3fvMESA		MANGLE(WindowPos3fvMESA) | #define glWindowPos3fvMESA		MANGLE(WindowPos3fvMESA) | ||||||
|  | #define glWindowPos3i		MANGLE(WindowPos3i) | ||||||
|  | #define glWindowPos3iARB		MANGLE(WindowPos3iARB) | ||||||
| #define glWindowPos3iMESA		MANGLE(WindowPos3iMESA) | #define glWindowPos3iMESA		MANGLE(WindowPos3iMESA) | ||||||
|  | #define glWindowPos3iv		MANGLE(WindowPos3iv) | ||||||
|  | #define glWindowPos3ivARB		MANGLE(WindowPos3ivARB) | ||||||
| #define glWindowPos3ivMESA		MANGLE(WindowPos3ivMESA) | #define glWindowPos3ivMESA		MANGLE(WindowPos3ivMESA) | ||||||
|  | #define glWindowPos3s		MANGLE(WindowPos3s) | ||||||
|  | #define glWindowPos3sARB		MANGLE(WindowPos3sARB) | ||||||
| #define glWindowPos3sMESA		MANGLE(WindowPos3sMESA) | #define glWindowPos3sMESA		MANGLE(WindowPos3sMESA) | ||||||
|  | #define glWindowPos3sv		MANGLE(WindowPos3sv) | ||||||
|  | #define glWindowPos3svARB		MANGLE(WindowPos3svARB) | ||||||
| #define glWindowPos3svMESA		MANGLE(WindowPos3svMESA) | #define glWindowPos3svMESA		MANGLE(WindowPos3svMESA) | ||||||
| #define glWindowPos4dMESA		MANGLE(WindowPos4dMESA) | #define glWindowPos4dMESA		MANGLE(WindowPos4dMESA) | ||||||
| #define glWindowPos4dvMESA		MANGLE(WindowPos4dvMESA) | #define glWindowPos4dvMESA		MANGLE(WindowPos4dvMESA) | ||||||
| @@ -1052,5 +1186,4 @@ | |||||||
| #define glWindowPos4sMESA		MANGLE(WindowPos4sMESA) | #define glWindowPos4sMESA		MANGLE(WindowPos4sMESA) | ||||||
| #define glWindowPos4svMESA		MANGLE(WindowPos4svMESA) | #define glWindowPos4svMESA		MANGLE(WindowPos4svMESA) | ||||||
| #define glWriteMaskEXT		MANGLE(WriteMaskEXT) | #define glWriteMaskEXT		MANGLE(WriteMaskEXT) | ||||||
|  |  | ||||||
| #endif /* GL_MANGLE_H */ | #endif /* GL_MANGLE_H */ | ||||||
|   | |||||||
| @@ -260,6 +260,9 @@ extern "C" { | |||||||
| #ifndef GLX_MESA_release_buffers | #ifndef GLX_MESA_release_buffers | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #ifndef GLX_MESA_agp_offset | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #ifndef GLX_MESA_set_3dfx_mode | #ifndef GLX_MESA_set_3dfx_mode | ||||||
| #define GLX_3DFX_WINDOW_MODE_MESA          0x1 | #define GLX_3DFX_WINDOW_MODE_MESA          0x1 | ||||||
| #define GLX_3DFX_FULLSCREEN_MODE_MESA      0x2 | #define GLX_3DFX_FULLSCREEN_MODE_MESA      0x2 | ||||||
| @@ -568,6 +571,14 @@ extern Bool glXSet3DfxModeMESA (int); | |||||||
| typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); | typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #ifndef GLX_MESA_agp_offset | ||||||
|  | #define GLX_MESA_agp_offset 1 | ||||||
|  | #ifdef GLX_GLXEXT_PROTOTYPES | ||||||
|  | extern GLuint glXGetAGPOffsetMESA (const GLvoid *); | ||||||
|  | #endif /* GLX_GLXEXT_PROTOTYPES */ | ||||||
|  | typedef GLuint ( * PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *); | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #ifndef GLX_SGIX_visual_select_group | #ifndef GLX_SGIX_visual_select_group | ||||||
| #define GLX_SGIX_visual_select_group 1 | #define GLX_SGIX_visual_select_group 1 | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| /* $Id: gloss.c,v 1.6 2000/12/24 22:53:54 pesco Exp $ */ | /* $Id: gloss.c,v 1.6.6.1 2002/11/28 15:52:11 brianp Exp $ */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Specular reflection demo.  The specular highlight is modulated by |  * Specular reflection demo.  The specular highlight is modulated by | ||||||
| @@ -85,9 +85,9 @@ static void Display( void ) | |||||||
|    glCallList(Object); |    glCallList(Object); | ||||||
|  |  | ||||||
|    /* Second pass: specular lighting with reflection texture */ |    /* Second pass: specular lighting with reflection texture */ | ||||||
|  |    glEnable(GL_POLYGON_OFFSET_FILL); | ||||||
|    glBlendFunc(GL_ONE, GL_ONE);  /* add */ |    glBlendFunc(GL_ONE, GL_ONE);  /* add */ | ||||||
|    glEnable(GL_BLEND); |    glEnable(GL_BLEND); | ||||||
|    glDepthFunc(GL_LEQUAL); |  | ||||||
|    glMaterialfv(GL_FRONT, GL_DIFFUSE, Black); |    glMaterialfv(GL_FRONT, GL_DIFFUSE, Black); | ||||||
|    glMaterialfv(GL_FRONT, GL_SPECULAR, White); |    glMaterialfv(GL_FRONT, GL_SPECULAR, White); | ||||||
|    if (DoSpecTexture) { |    if (DoSpecTexture) { | ||||||
| @@ -102,6 +102,7 @@ static void Display( void ) | |||||||
|    glDisable(GL_TEXTURE_GEN_S); |    glDisable(GL_TEXTURE_GEN_S); | ||||||
|    glDisable(GL_TEXTURE_GEN_T); |    glDisable(GL_TEXTURE_GEN_T); | ||||||
|    glDisable(GL_BLEND); |    glDisable(GL_BLEND); | ||||||
|  |    glDisable(GL_POLYGON_OFFSET_FILL); | ||||||
|  |  | ||||||
|    glPopMatrix(); |    glPopMatrix(); | ||||||
|  |  | ||||||
| @@ -341,6 +342,8 @@ static void Init( int argc, char *argv[] ) | |||||||
|    glEnable(GL_DEPTH_TEST); |    glEnable(GL_DEPTH_TEST); | ||||||
|    glEnable(GL_NORMALIZE); |    glEnable(GL_NORMALIZE); | ||||||
|  |  | ||||||
|  |    glPolygonOffset( -1, -1 ); | ||||||
|  |  | ||||||
|    if (argc > 1 && strcmp(argv[1], "-info")==0) { |    if (argc > 1 && strcmp(argv[1], "-info")==0) { | ||||||
|       printf("GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER)); |       printf("GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER)); | ||||||
|       printf("GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION)); |       printf("GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION)); | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| /* $Id: osdemo.c,v 1.9 2002/07/12 15:54:19 brianp Exp $ */ | /* $Id: osdemo.c,v 1.9.4.1 2003/03/03 03:14:55 brianp Exp $ */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Demo of off-screen Mesa rendering |  * Demo of off-screen Mesa rendering | ||||||
| @@ -139,6 +139,11 @@ static void render_image( void ) | |||||||
|  |  | ||||||
|    glPopMatrix(); |    glPopMatrix(); | ||||||
|  |  | ||||||
|  |    /* This is very important!!! | ||||||
|  |     * Make sure buffered commands are finished!!! | ||||||
|  |     */ | ||||||
|  |    glFinish(); | ||||||
|  |  | ||||||
|    Frames++; |    Frames++; | ||||||
|    if (perf) { |    if (perf) { | ||||||
|      GLint t = glutGet(GLUT_ELAPSED_TIME); |      GLint t = glutGet(GLUT_ELAPSED_TIME); | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ | |||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| #include <windows.h> | #include <windows.h> | ||||||
| #endif | #endif | ||||||
| #define GL_GLEXT_LEGACY | #define GL_GLEXT_PROTOTYPES | ||||||
| #include <GL/glut.h> | #include <GL/glut.h> | ||||||
|  |  | ||||||
| /* Some <math.h> files do not define M_PI... */ | /* Some <math.h> files do not define M_PI... */ | ||||||
| @@ -264,15 +264,15 @@ menu(int option) | |||||||
|   case 0: |   case 0: | ||||||
|     makePointList(); |     makePointList(); | ||||||
|     break; |     break; | ||||||
| #if GL_EXT_point_parameters | #if GL_ARB_point_parameters | ||||||
|   case 1: |   case 1: | ||||||
|     glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, constant); |     glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, constant); | ||||||
|     break; |     break; | ||||||
|   case 2: |   case 2: | ||||||
|     glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, linear); |     glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, linear); | ||||||
|     break; |     break; | ||||||
|   case 3: |   case 3: | ||||||
|     glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, theQuad); |     glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad); | ||||||
|     break; |     break; | ||||||
| #endif | #endif | ||||||
|   case 4: |   case 4: | ||||||
| @@ -281,12 +281,12 @@ menu(int option) | |||||||
|   case 5: |   case 5: | ||||||
|     blend = 0; |     blend = 0; | ||||||
|     break; |     break; | ||||||
| #if GL_EXT_point_parameters | #if GL_ARB_point_parameters | ||||||
|   case 6: |   case 6: | ||||||
|     glPointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, 1.0); |     glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1.0); | ||||||
|     break; |     break; | ||||||
|   case 7: |   case 7: | ||||||
|     glPointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, 10.0); |     glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 10.0); | ||||||
|     break; |     break; | ||||||
| #endif | #endif | ||||||
|   case 8: |   case 8: | ||||||
| @@ -468,8 +468,8 @@ main(int argc, char **argv) | |||||||
|   glEnable(GL_POINT_SMOOTH); |   glEnable(GL_POINT_SMOOTH); | ||||||
|   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||||||
|   glPointSize(8.0); |   glPointSize(8.0); | ||||||
| #if GL_EXT_point_parameters | #if GL_ARB_point_parameters | ||||||
|   glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, theQuad); |   glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad); | ||||||
| #endif | #endif | ||||||
|   glMatrixMode(GL_PROJECTION); |   glMatrixMode(GL_PROJECTION); | ||||||
|   gluPerspective( /* field of view in degree */ 40.0, |   gluPerspective( /* field of view in degree */ 40.0, | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| /* $Id: winpos.c,v 1.5 2002/04/22 16:03:37 brianp Exp $ */ | /* $Id: winpos.c,v 1.5.4.2 2003/02/28 18:03:45 kschultz Exp $ */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Example of how to use the GL_MESA_window_pos extension. |  * Example of how to use the GL_MESA_window_pos extension. | ||||||
| @@ -12,7 +12,7 @@ | |||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| #include <windows.h> | #include <windows.h> | ||||||
| #endif | #endif | ||||||
| #define GL_GLEXT_LEGACY | #define GL_GLEXT_PROTOTYPES | ||||||
| #include "GL/glut.h" | #include "GL/glut.h" | ||||||
|  |  | ||||||
| #include "readtex.c"  /* a hack, I know */ | #include "readtex.c"  /* a hack, I know */ | ||||||
| @@ -30,18 +30,13 @@ static GLubyte *Image; | |||||||
| static int ImgWidth, ImgHeight; | static int ImgWidth, ImgHeight; | ||||||
| static GLenum ImgFormat; | static GLenum ImgFormat; | ||||||
|  |  | ||||||
|  | typedef void (APIENTRY * PFNWINDOWPOSFUNC)(GLfloat x, GLfloat y); | ||||||
|  | static PFNWINDOWPOSFUNC WindowPosFunc; | ||||||
|  |  | ||||||
|  |  | ||||||
| static void draw( void ) | static void draw( void ) | ||||||
| { | { | ||||||
|    GLfloat angle; |    GLfloat angle; | ||||||
|    char *extensions; |  | ||||||
|  |  | ||||||
|    extensions = (char *) glGetString( GL_EXTENSIONS ); |  | ||||||
|    if (strstr( extensions, "GL_MESA_window_pos")==NULL) { |  | ||||||
|       printf("Sorry, GL_MESA_window_pos extension not available.\n"); |  | ||||||
|       return; |  | ||||||
|    } |  | ||||||
|  |  | ||||||
|    glClear( GL_COLOR_BUFFER_BIT ); |    glClear( GL_COLOR_BUFFER_BIT ); | ||||||
|  |  | ||||||
| @@ -50,16 +45,14 @@ static void draw( void ) | |||||||
|       GLfloat y = 50.0 + 200.0 * sin( angle * M_PI / 180.0 ); |       GLfloat y = 50.0 + 200.0 * sin( angle * M_PI / 180.0 ); | ||||||
|  |  | ||||||
|       /* Don't need to worry about the modelview or projection matrices!!! */ |       /* Don't need to worry about the modelview or projection matrices!!! */ | ||||||
| #ifdef GL_MESA_window_pos |       (*WindowPosFunc)( x, y ); | ||||||
|       glWindowPos2fMESA( x, y ); |  | ||||||
| #endif |  | ||||||
|       glDrawPixels( ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image ); |       glDrawPixels( ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image ); | ||||||
|    } |    } | ||||||
|  |    glFinish(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static void key( unsigned char key, int x, int y ) | static void key( unsigned char key, int x, int y ) | ||||||
| { | { | ||||||
|    (void) x; |    (void) x; | ||||||
| @@ -71,7 +64,6 @@ static void key( unsigned char key, int x, int y ) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* new window size or exposure */ | /* new window size or exposure */ | ||||||
| static void reshape( int width, int height ) | static void reshape( int width, int height ) | ||||||
| { | { | ||||||
| @@ -81,6 +73,24 @@ static void reshape( int width, int height ) | |||||||
|  |  | ||||||
| static void init( void ) | static void init( void ) | ||||||
| { | { | ||||||
|  | #ifdef GL_ARB_window_pos | ||||||
|  |    if (glutExtensionSupported("GL_ARB_window_pos")) { | ||||||
|  |       printf("Using GL_ARB_window_pos\n"); | ||||||
|  |       WindowPosFunc = &glWindowPos2fARB; | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  | #elif defined(GL_ARB_window_pos) | ||||||
|  |    if (glutExtensionSupported("GL_MESA_window_pos")) { | ||||||
|  |       printf("Using GL_MESA_window_pos\n"); | ||||||
|  |       WindowPosFunc = &glWindowPos2fMESA; | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  | #endif | ||||||
|  |    { | ||||||
|  |       printf("Sorry, GL_ARB/MESA_window_pos extension not available.\n"); | ||||||
|  |       exit(1); | ||||||
|  |    } | ||||||
|  |  | ||||||
|    Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat ); |    Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat ); | ||||||
|    if (!Image) { |    if (!Image) { | ||||||
|       printf("Couldn't read %s\n", IMAGE_FILE); |       printf("Couldn't read %s\n", IMAGE_FILE); | ||||||
| @@ -90,7 +100,6 @@ static void init( void ) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int main( int argc, char *argv[] ) | int main( int argc, char *argv[] ) | ||||||
| { | { | ||||||
|    glutInitWindowPosition(0, 0); |    glutInitWindowPosition(0, 0); | ||||||
|   | |||||||
| @@ -1,36 +1,86 @@ | |||||||
| # $Id: Makefile.DJ,v 1.1 1999/08/19 00:55:41 jtg Exp $ | # Mesa 3-D graphics library | ||||||
|  | # Version:  4.0 | ||||||
| # Makefile for sample programs for MS-DOS with DJGPP | #  | ||||||
|  | # Copyright (C) 1999  Brian Paul   All Rights Reserved. | ||||||
| ##### MACROS ##### | #  | ||||||
|  | # Permission is hereby granted, free of charge, to any person obtaining a | ||||||
| INCDIR = ../include | # copy of this software and associated documentation files (the "Software"), | ||||||
|  | # to deal in the Software without restriction, including without limitation | ||||||
| GL_LIBS =  ../lib/dosglut.a ../lib/dosglub.a ../lib/dosmesa.a | # the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  | # and/or sell copies of the Software, and to permit persons to whom the | ||||||
| LIB_DEP = $(GL_LIBS) | # Software is furnished to do so, subject to the following conditions: | ||||||
|  | #  | ||||||
| PROGS = accum bitmap1 bitmap2 blendeq blendxor copy depth \ | # The above copyright notice and this permission notice shall be included | ||||||
| 	eval fog font line logo nurb olympic \ | # in all copies or substantial portions of the Software. | ||||||
| 	point prim quad select shape \ | #  | ||||||
| 	sphere star stencil stretch texture \ | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
| 	tri wave | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
| ##### RULES ##### | # BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
| .c: $(LIB_DEP) | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
| 	gcc -I$(INCDIR) $(CFLAGS) $< $(LIB_DEP) -o $@ |  | ||||||
|  | # DOS/DJGPP samples makefile v1.3 for Mesa | ||||||
|  | # | ||||||
| ##### TARGETS ##### | #  Copyright (C) 2002 - Borca Daniel | ||||||
|  | #  Email : dborca@yahoo.com | ||||||
| default: $(PROGS) | #  Web   : http://www.geocities.com/dborca | ||||||
|  |  | ||||||
| clean: |  | ||||||
| 	del *.  | # | ||||||
|  | #  Available options: | ||||||
| realclean: clean | # | ||||||
| 	del *.exe | #    Environment variables: | ||||||
|  | #	CPU		optimize for the given processor. | ||||||
|  | #			default = k6 | ||||||
|  | #	GLIDE		path to Glide3 SDK library files; used with FX. | ||||||
|  | #			default = $(TOP)/lib/glide3 | ||||||
|  | #	FX=1		build for 3dfx Glide3. Note that this disables | ||||||
|  | #			compilation of most DMesa code and requires fxMesa. | ||||||
|  | #			As a consequence, you'll need the DJGPP Glide3 | ||||||
|  | #			library to build any application. | ||||||
|  | #			default = no | ||||||
|  | #	DXE=1		use DXE modules. The resolution object file must be | ||||||
|  | #			present in the `lib' directory in order to use this | ||||||
|  | #			option (see README.DJ for details). | ||||||
|  | #			default = no | ||||||
|  | # | ||||||
|  | #    Targets: | ||||||
|  | #	<file.exe>	build a specific file | ||||||
|  | # | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | .PHONY : all | ||||||
|  | .SUFFIXES : .c .o .exe | ||||||
|  |  | ||||||
|  | TOP = .. | ||||||
|  | CPU ?= k6 | ||||||
|  | GLIDE ?= $(TOP)/lib/glide3 | ||||||
|  |  | ||||||
|  | CC = gcc | ||||||
|  | CFLAGS = -Wall -W -pedantic | ||||||
|  | CFLAGS += -O2 -ffast-math -mcpu=$(CPU) | ||||||
|  | CFLAGS += -I$(TOP)/include | ||||||
|  |  | ||||||
|  | LD = gxx | ||||||
|  | LDFLAGS = -s -L$(TOP)/lib | ||||||
|  |  | ||||||
|  | ifeq ($(DXE),1) | ||||||
|  | DXE3TABLE = $(TOP)/lib/dxe3tbl.o | ||||||
|  | LDLIBS += -liglut -liglu -ligl -ldl | ||||||
|  | else | ||||||
|  | LDLIBS = -lglut -lglu -lgl | ||||||
|  | ifeq ($(FX),1) | ||||||
|  | LDFLAGS += -L$(GLIDE) | ||||||
|  | LDLIBS += -lglid3 | ||||||
|  | endif | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | .c.o: | ||||||
|  | 	$(CC) -o $@ $(CFLAGS) -c $< | ||||||
|  | .o.exe: | ||||||
|  | 	$(LD) -o $@ $(LDFLAGS) $(DXE3TABLE) $< $(LDLIBS) | ||||||
|  |  | ||||||
|  | all: | ||||||
|  | 	$(error Must specify <filename.exe> to build) | ||||||
|   | |||||||
| @@ -256,18 +256,30 @@ int main(int argc, char **argv) | |||||||
| { | { | ||||||
| 	int width, height; | 	int width, height; | ||||||
| 	GLubyte *data; | 	GLubyte *data; | ||||||
|  |         char buff[32]; | ||||||
|  |         int n; | ||||||
|  |         FILE *fo; | ||||||
|  |  | ||||||
| 	if (argc != 2) | 	if (argc != 3) | ||||||
| 	{ | 	{ | ||||||
| 		fprintf(stderr, "usage: %s <filename>\n", argv[0]); | 		fprintf(stderr, "usage: %s <infile.rgb> <outfile.p6>\n", argv[0]); | ||||||
| 		return 1; | 		return 1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	data = read_rgb_texture(argv[1], &width, &height); | 	data = read_rgb_texture(argv[1], &width, &height); | ||||||
|  |  | ||||||
| 	printf("P6\n%d %d\n255\n", width, height); | 	n = sprintf(buff, "P6\n%d %d\n255\n", width, height); | ||||||
| 	fwrite(data, width * 3, height, stdout); |  | ||||||
|  |         /* [dBorca] avoid LF to CRLF conversion */ | ||||||
|  |         if ((fo = fopen(argv[2], "wb")) == NULL) { | ||||||
|  |            fprintf(stderr, "Cannot open output file!\n"); | ||||||
|  |            exit(1); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  | 	fwrite(buff, n, 1, fo); | ||||||
|  | 	fwrite(data, width * 3, height, fo); | ||||||
|  |  | ||||||
|  |         fclose(fo); | ||||||
|  |  | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| /* $Id: cva.c,v 1.4 2002/01/16 01:03:25 kschultz Exp $ */ | /* $Id: cva.c,v 1.4.4.1 2003/01/28 15:31:49 brianp Exp $ */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Trivial CVA test, good for testing driver fastpaths (especially |  * Trivial CVA test, good for testing driver fastpaths (especially | ||||||
| @@ -133,7 +133,9 @@ int main( int argc, char **argv ) | |||||||
|     */ |     */ | ||||||
|    string = (char *) glGetString( GL_VERSION ); |    string = (char *) glGetString( GL_VERSION ); | ||||||
|  |  | ||||||
|    if ( (!strstr( string, "1.2" ))&&(!strstr(string,"1.3"))) { |    if ( !strstr(string, "1.2") && | ||||||
|  |         !strstr(string, "1.3") && | ||||||
|  |         !strstr(string, "1.4")) { | ||||||
|       fprintf( stderr, "This program requires OpenGL 1.2 vertex arrays.\n" ); |       fprintf( stderr, "This program requires OpenGL 1.2 vertex arrays.\n" ); | ||||||
|       exit( -1 ); |       exit( -1 ); | ||||||
|    } |    } | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| /* $Id: texwrap.c,v 1.4 2002/10/18 17:47:36 kschultz Exp $ */ | /* $Id: texwrap.c,v 1.4.2.1 2003/02/04 02:34:42 brianp Exp $ */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Test texture wrap modes. |  * Test texture wrap modes. | ||||||
| @@ -119,7 +119,7 @@ static void Display( void ) | |||||||
| #if 0 | #if 0 | ||||||
|    /* draw texture as image */ |    /* draw texture as image */ | ||||||
|    glDisable(GL_TEXTURE_2D); |    glDisable(GL_TEXTURE_2D); | ||||||
|    glWindowPos2iMESA(1, 1); |    glWindowPos2iARB(1, 1); | ||||||
|    glDrawPixels(6, 6, GL_RGBA, GL_UNSIGNED_BYTE, (void *) TexImage); |    glDrawPixels(6, 6, GL_RGBA, GL_UNSIGNED_BYTE, (void *) TexImage); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -183,7 +183,7 @@ static void Display( void ) | |||||||
|    offset = 0; |    offset = 0; | ||||||
|    for (i = 0; i < modes[i].mode != 0; i++) { |    for (i = 0; i < modes[i].mode != 0; i++) { | ||||||
|       if ( modes[i].supported ) { |       if ( modes[i].supported ) { | ||||||
|          glWindowPos2iMESA( offset * 150 + 10, 5 + ((offset & 1) * 15) ); |          glWindowPos2iARB( offset * 150 + 10, 5 + ((offset & 1) * 15) ); | ||||||
| 	 PrintString(modes[i].name); | 	 PrintString(modes[i].name); | ||||||
| 	 offset++; | 	 offset++; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ | |||||||
| # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
| # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  | ||||||
| # DOS/DJGPP glu makefile v1.1 for Mesa 4.0 | # DOS/DJGPP glu makefile v1.3 for Mesa | ||||||
| # | # | ||||||
| #  Copyright (C) 2002 - Borca Daniel | #  Copyright (C) 2002 - Borca Daniel | ||||||
| #  Email : dborca@yahoo.com | #  Email : dborca@yahoo.com | ||||||
| @@ -52,14 +52,16 @@ CC = gcc | |||||||
| CFLAGS += -I$(TOP)/include | CFLAGS += -I$(TOP)/include | ||||||
|  |  | ||||||
| AR = ar | AR = ar | ||||||
| ARFLAGS = ru | ARFLAGS = rus | ||||||
|  |  | ||||||
| ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),) | HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) | ||||||
| DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH)))) |  | ||||||
|  | ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) | ||||||
|  | UNLINK = del $(subst /,\,$(1)) | ||||||
|  | else | ||||||
|  | UNLINK = $(RM) $(1) | ||||||
| endif | endif | ||||||
|  |  | ||||||
| RM = del |  | ||||||
|  |  | ||||||
| CORE_SOURCES = \ | CORE_SOURCES = \ | ||||||
| 	glu.c \ | 	glu.c \ | ||||||
| 	mipmap.c \ | 	mipmap.c \ | ||||||
| @@ -78,7 +80,7 @@ SOURCES = $(CORE_SOURCES) | |||||||
| OBJECTS = $(SOURCES:.c=.o) | OBJECTS = $(SOURCES:.c=.o) | ||||||
|  |  | ||||||
| .c.o: | .c.o: | ||||||
| 	$(CC) -o $@ -c $(CFLAGS) $< | 	$(CC) -o $@ $(CFLAGS) -c $< | ||||||
|  |  | ||||||
| all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP) | all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP) | ||||||
|  |  | ||||||
| @@ -86,14 +88,13 @@ $(LIBDIR)/$(GLU_LIB): $(OBJECTS) | |||||||
| 	$(AR) $(ARFLAGS) $(LIBDIR)/$(GLU_LIB) $(OBJECTS) | 	$(AR) $(ARFLAGS) $(LIBDIR)/$(GLU_LIB) $(OBJECTS) | ||||||
|  |  | ||||||
| $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) | $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) | ||||||
| ifeq ($(DXE2GEN),) | ifeq ($(HAVEDXE3),) | ||||||
| 	$(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN) | 	$(warning Missing DXE3 package... Skipping $(GLU_DXE)) | ||||||
| 	$(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.) |  | ||||||
| else | else | ||||||
| 	-dxe2gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) $(OBJECTS) -E djgpp_ -E glu -D "Mesa DJGPP GLU" -U | 	-dxe3gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) -D "MesaGLU DJGPP" -E _glu -P gl.dxe -U $(OBJECTS) | ||||||
| endif | endif | ||||||
|  |  | ||||||
| clean: | clean: | ||||||
| 	-$(RM) $(subst /,\,*.o) | 	-$(call UNLINK,*.o) | ||||||
|  |  | ||||||
| -include depend | -include depend | ||||||
|   | |||||||
							
								
								
									
										188
									
								
								src/glu/sgi/Makefile.DJ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								src/glu/sgi/Makefile.DJ
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,188 @@ | |||||||
|  | # Mesa 3-D graphics library | ||||||
|  | # Version:  4.0 | ||||||
|  | #  | ||||||
|  | # Copyright (C) 1999  Brian Paul   All Rights Reserved. | ||||||
|  | #  | ||||||
|  | # Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  | # copy of this software and associated documentation files (the "Software"), | ||||||
|  | # to deal in the Software without restriction, including without limitation | ||||||
|  | # the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  | # and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  | # Software is furnished to do so, subject to the following conditions: | ||||||
|  | #  | ||||||
|  | # The above copyright notice and this permission notice shall be included | ||||||
|  | # in all copies or substantial portions of the Software. | ||||||
|  | #  | ||||||
|  | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  | # BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  | ||||||
|  | # DOS/DJGPP glu makefile v1.3 for Mesa | ||||||
|  | # | ||||||
|  | #  Copyright (C) 2002 - Borca Daniel | ||||||
|  | #  Email : dborca@yahoo.com | ||||||
|  | #  Web   : http://www.geocities.com/dborca | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # | ||||||
|  | #  Available options: | ||||||
|  | # | ||||||
|  | #    Environment variables: | ||||||
|  | #	CFLAGS | ||||||
|  | # | ||||||
|  | #    Targets: | ||||||
|  | #	all:		build GLU | ||||||
|  | #	clean:		remove object files | ||||||
|  | # | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | .PHONY: all clean | ||||||
|  |  | ||||||
|  | TOP = .. | ||||||
|  | LIBDIR = $(TOP)/lib | ||||||
|  | GLU_LIB = libglu.a | ||||||
|  | GLU_DXE = glu.dxe | ||||||
|  | GLU_IMP = libiglu.a | ||||||
|  |  | ||||||
|  | CC = gcc | ||||||
|  | CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude | ||||||
|  | CXX = gpp | ||||||
|  | CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess | ||||||
|  |  | ||||||
|  | AR = ar | ||||||
|  | ARFLAGS = rus | ||||||
|  |  | ||||||
|  | HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) | ||||||
|  |  | ||||||
|  | ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) | ||||||
|  | UNLINK = del $(subst /,\,$(1)) | ||||||
|  | else | ||||||
|  | UNLINK = $(RM) $(1) | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | C_SOURCES = \ | ||||||
|  | 	libutil/error.c \ | ||||||
|  | 	libutil/glue.c \ | ||||||
|  | 	libutil/mipmap.c \ | ||||||
|  | 	libutil/project.c \ | ||||||
|  | 	libutil/quad.c \ | ||||||
|  | 	libutil/registry.c \ | ||||||
|  | 	libtess/dict.c \ | ||||||
|  | 	libtess/geom.c \ | ||||||
|  | 	libtess/memalloc.c \ | ||||||
|  | 	libtess/mesh.c \ | ||||||
|  | 	libtess/normal.c \ | ||||||
|  | 	libtess/priorityq.c \ | ||||||
|  | 	libtess/render.c \ | ||||||
|  | 	libtess/sweep.c \ | ||||||
|  | 	libtess/tess.c \ | ||||||
|  | 	libtess/tessmono.c | ||||||
|  |  | ||||||
|  | CC_SOURCES = \ | ||||||
|  | 	libnurbs/interface/bezierEval.cc \ | ||||||
|  | 	libnurbs/interface/bezierPatch.cc \ | ||||||
|  | 	libnurbs/interface/bezierPatchMesh.cc \ | ||||||
|  | 	libnurbs/interface/glcurveval.cc \ | ||||||
|  | 	libnurbs/interface/glinterface.cc \ | ||||||
|  | 	libnurbs/interface/glrenderer.cc \ | ||||||
|  | 	libnurbs/interface/glsurfeval.cc \ | ||||||
|  | 	libnurbs/interface/incurveeval.cc \ | ||||||
|  | 	libnurbs/interface/insurfeval.cc \ | ||||||
|  | 	libnurbs/internals/arc.cc \ | ||||||
|  | 	libnurbs/internals/arcsorter.cc \ | ||||||
|  | 	libnurbs/internals/arctess.cc \ | ||||||
|  | 	libnurbs/internals/backend.cc \ | ||||||
|  | 	libnurbs/internals/basiccrveval.cc \ | ||||||
|  | 	libnurbs/internals/basicsurfeval.cc \ | ||||||
|  | 	libnurbs/internals/bin.cc \ | ||||||
|  | 	libnurbs/internals/bufpool.cc \ | ||||||
|  | 	libnurbs/internals/cachingeval.cc \ | ||||||
|  | 	libnurbs/internals/ccw.cc \ | ||||||
|  | 	libnurbs/internals/coveandtiler.cc \ | ||||||
|  | 	libnurbs/internals/curve.cc \ | ||||||
|  | 	libnurbs/internals/curvelist.cc \ | ||||||
|  | 	libnurbs/internals/curvesub.cc \ | ||||||
|  | 	libnurbs/internals/dataTransform.cc \ | ||||||
|  | 	libnurbs/internals/displaylist.cc \ | ||||||
|  | 	libnurbs/internals/flist.cc \ | ||||||
|  | 	libnurbs/internals/flistsorter.cc \ | ||||||
|  | 	libnurbs/internals/hull.cc \ | ||||||
|  | 	libnurbs/internals/intersect.cc \ | ||||||
|  | 	libnurbs/internals/knotvector.cc \ | ||||||
|  | 	libnurbs/internals/mapdesc.cc \ | ||||||
|  | 	libnurbs/internals/mapdescv.cc \ | ||||||
|  | 	libnurbs/internals/maplist.cc \ | ||||||
|  | 	libnurbs/internals/mesher.cc \ | ||||||
|  | 	libnurbs/internals/monoTriangulationBackend.cc \ | ||||||
|  | 	libnurbs/internals/monotonizer.cc \ | ||||||
|  | 	libnurbs/internals/mycode.cc \ | ||||||
|  | 	libnurbs/internals/nurbsinterfac.cc \ | ||||||
|  | 	libnurbs/internals/nurbstess.cc \ | ||||||
|  | 	libnurbs/internals/patch.cc \ | ||||||
|  | 	libnurbs/internals/patchlist.cc \ | ||||||
|  | 	libnurbs/internals/quilt.cc \ | ||||||
|  | 	libnurbs/internals/reader.cc \ | ||||||
|  | 	libnurbs/internals/renderhints.cc \ | ||||||
|  | 	libnurbs/internals/slicer.cc \ | ||||||
|  | 	libnurbs/internals/sorter.cc \ | ||||||
|  | 	libnurbs/internals/splitarcs.cc \ | ||||||
|  | 	libnurbs/internals/subdivider.cc \ | ||||||
|  | 	libnurbs/internals/tobezier.cc \ | ||||||
|  | 	libnurbs/internals/trimline.cc \ | ||||||
|  | 	libnurbs/internals/trimregion.cc \ | ||||||
|  | 	libnurbs/internals/trimvertpool.cc \ | ||||||
|  | 	libnurbs/internals/uarray.cc \ | ||||||
|  | 	libnurbs/internals/varray.cc \ | ||||||
|  | 	libnurbs/nurbtess/directedLine.cc \ | ||||||
|  | 	libnurbs/nurbtess/gridWrap.cc \ | ||||||
|  | 	libnurbs/nurbtess/monoChain.cc \ | ||||||
|  | 	libnurbs/nurbtess/monoPolyPart.cc \ | ||||||
|  | 	libnurbs/nurbtess/monoTriangulation.cc \ | ||||||
|  | 	libnurbs/nurbtess/partitionX.cc \ | ||||||
|  | 	libnurbs/nurbtess/partitionY.cc \ | ||||||
|  | 	libnurbs/nurbtess/polyDBG.cc \ | ||||||
|  | 	libnurbs/nurbtess/polyUtil.cc \ | ||||||
|  | 	libnurbs/nurbtess/primitiveStream.cc \ | ||||||
|  | 	libnurbs/nurbtess/quicksort.cc \ | ||||||
|  | 	libnurbs/nurbtess/rectBlock.cc \ | ||||||
|  | 	libnurbs/nurbtess/sampleComp.cc \ | ||||||
|  | 	libnurbs/nurbtess/sampleCompBot.cc \ | ||||||
|  | 	libnurbs/nurbtess/sampleCompRight.cc \ | ||||||
|  | 	libnurbs/nurbtess/sampleCompTop.cc \ | ||||||
|  | 	libnurbs/nurbtess/sampleMonoPoly.cc \ | ||||||
|  | 	libnurbs/nurbtess/sampledLine.cc \ | ||||||
|  | 	libnurbs/nurbtess/searchTree.cc | ||||||
|  |  | ||||||
|  | SOURCES = $(C_SOURCES) $(CC_SOURCES) | ||||||
|  |  | ||||||
|  | OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) | ||||||
|  |  | ||||||
|  | .c.o: | ||||||
|  | 	$(CC) -o $@ $(CFLAGS) -c $< | ||||||
|  | .cc.o: | ||||||
|  | 	$(CXX) -o $@ $(CXXFLAGS) -c $< | ||||||
|  |  | ||||||
|  | all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP) | ||||||
|  |  | ||||||
|  | $(LIBDIR)/$(GLU_LIB): $(OBJECTS) | ||||||
|  | 	$(AR) $(ARFLAGS) $(LIBDIR)/$(GLU_LIB) $(OBJECTS) | ||||||
|  |  | ||||||
|  | $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) | ||||||
|  | ifeq ($(HAVEDXE3),) | ||||||
|  | 	$(warning Missing DXE3 package... Skipping $(GLU_DXE)) | ||||||
|  | else | ||||||
|  | 	-dxe3gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) -D "MesaGLU/SGI DJGPP" -E _glu -P gl.dxe -U $(OBJECTS) | ||||||
|  | endif | ||||||
|  |  | ||||||
|  | clean: | ||||||
|  | 	-$(call UNLINK,libutil/*.o) | ||||||
|  | 	-$(call UNLINK,libtess/*.o) | ||||||
|  | 	-$(call UNLINK,libnurbs/interface/*.o) | ||||||
|  | 	-$(call UNLINK,libnurbs/internals/*.o) | ||||||
|  | 	-$(call UNLINK,libnurbs/nurbtess/*.o) | ||||||
|  |  | ||||||
|  | -include depend | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| /* | /* | ||||||
| ** gluos.h - operating system dependencies for GLU | ** gluos.h - operating system dependencies for GLU | ||||||
| ** | ** | ||||||
| ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/include/gluos.h,v 1.4 2002/10/04 15:58:33 kschultz Exp $ | ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/include/gluos.h,v 1.4.4.1 2003/02/12 16:04:45 brianp Exp $ | ||||||
| */ | */ | ||||||
| #ifdef __VMS | #ifdef __VMS | ||||||
| #ifdef __cplusplus  | #ifdef __cplusplus  | ||||||
| @@ -37,6 +37,13 @@ | |||||||
| #pragma comment(linker, "/OPT:NOWIN98") | #pragma comment(linker, "/OPT:NOWIN98") | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #elif defined(__OS2__) | ||||||
|  |  | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include <stdio.h> | ||||||
|  | #include <malloc.h> | ||||||
|  | #define WINGDIAPI | ||||||
|  |  | ||||||
| #else | #else | ||||||
|  |  | ||||||
| /* Disable Microsoft-specific keywords */ | /* Disable Microsoft-specific keywords */ | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ | |||||||
| # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
| # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  | ||||||
| # DOS/DJGPP glut makefile v1.1 for Mesa 4.0 | # DOS/DJGPP glut makefile v1.3 for Mesa | ||||||
| # | # | ||||||
| #  Copyright (C) 2002 - Borca Daniel | #  Copyright (C) 2002 - Borca Daniel | ||||||
| #  Email : dborca@yahoo.com | #  Email : dborca@yahoo.com | ||||||
| @@ -33,14 +33,7 @@ | |||||||
| #    Environment variables: | #    Environment variables: | ||||||
| #	CFLAGS | #	CFLAGS | ||||||
| # | # | ||||||
| #	GLIDE		absolute path to Glide SDK; used with FX. | #	MKGLUT		absolute path to original GLUT. | ||||||
| #			default = $(TOP)/include/glide3 |  | ||||||
| #	FX=1		build for 3dfx Glide3; use it if you have the glide |  | ||||||
| #			SDK (designed for your platform), and, of course, a |  | ||||||
| #			3dfx card... Note that this disables compilation of |  | ||||||
| #			actual DMesa code, as Glide does all the stuff! |  | ||||||
| #			default = no |  | ||||||
| #	MARK		absolute path to original GLUT. |  | ||||||
| #			default = $(TOP)/src-glut | #			default = $(TOP)/src-glut | ||||||
| # | # | ||||||
| #    Targets: | #    Targets: | ||||||
| @@ -54,38 +47,35 @@ | |||||||
|  |  | ||||||
| TOP = .. | TOP = .. | ||||||
| GLIDE ?= $(TOP)/include/glide3 | GLIDE ?= $(TOP)/include/glide3 | ||||||
| MARK ?= $(TOP)/src-glut | MKGLUT ?= $(TOP)/src-glut | ||||||
| LIBDIR = $(TOP)/lib | LIBDIR = $(TOP)/lib | ||||||
| GLUT_LIB = libglut.a | GLUT_LIB = libglut.a | ||||||
| GLUT_DXE = glut.dxe | GLUT_DXE = glut.dxe | ||||||
| GLUT_IMP = libiglut.a | GLUT_IMP = libiglut.a | ||||||
|  |  | ||||||
| CC = gcc | CC = gcc | ||||||
| CFLAGS += -I$(TOP)/include -I$(MARK) | CFLAGS += -I- -I$(TOP)/include -I. -I$(MKGLUT) -IPC_HW | ||||||
| ifdef FX |  | ||||||
| CFLAGS += -D__DOS__ -I$(GLIDE) -DFX -DFX_GLIDE3 -DFXMESA_USE_ARGB |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| AR = ar | AR = ar | ||||||
| ARFLAGS = ru | ARFLAGS = rus | ||||||
|  |  | ||||||
| ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),) | HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) | ||||||
| DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH)))) |  | ||||||
|  | ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) | ||||||
|  | UNLINK = del $(subst /,\,$(1)) | ||||||
|  | else | ||||||
|  | UNLINK = $(RM) $(1) | ||||||
| endif | endif | ||||||
|  |  | ||||||
| RM = del |  | ||||||
|  |  | ||||||
| CORE_SOURCES = \ | CORE_SOURCES = \ | ||||||
| 	bitmap.c \ |  | ||||||
| 	callback.c \ | 	callback.c \ | ||||||
| 	color.c \ | 	color.c \ | ||||||
| 	globals.c \ | 	extens.c \ | ||||||
| 	init.c \ | 	init.c \ | ||||||
| 	menu.c \ | 	menu.c \ | ||||||
| 	models.c \ | 	mouse.c \ | ||||||
| 	overlay.c \ | 	overlay.c \ | ||||||
| 	state.c \ | 	state.c \ | ||||||
| 	teapot.c \ |  | ||||||
| 	window.c | 	window.c | ||||||
|  |  | ||||||
| PC_HW_SOURCES = \ | PC_HW_SOURCES = \ | ||||||
| @@ -95,25 +85,34 @@ PC_HW_SOURCES = \ | |||||||
| 	PC_HW/pc_timer.c \ | 	PC_HW/pc_timer.c \ | ||||||
| 	PC_HW/pc_irq.S | 	PC_HW/pc_irq.S | ||||||
|  |  | ||||||
| MARK_SOURCES = \ | MKGLUT_SOURCES = \ | ||||||
| 	$(MARK)/glut_8x13.c \ | 	$(MKGLUT)/glut_bitmap.c \ | ||||||
| 	$(MARK)/glut_9x15.c \ | 	$(MKGLUT)/glut_bwidth.c \ | ||||||
| 	$(MARK)/glut_hel10.c \ | 	$(MKGLUT)/glut_stroke.c \ | ||||||
| 	$(MARK)/glut_hel12.c \ | 	$(MKGLUT)/glut_swidth.c \ | ||||||
| 	$(MARK)/glut_hel18.c \ | 	$(MKGLUT)/glut_shapes.c \ | ||||||
| 	$(MARK)/glut_tr10.c \ | 	$(MKGLUT)/glut_teapot.c \ | ||||||
| 	$(MARK)/glut_tr24.c | 	$(MKGLUT)/glut_8x13.c \ | ||||||
|  | 	$(MKGLUT)/glut_9x15.c \ | ||||||
|  | 	$(MKGLUT)/glut_hel10.c \ | ||||||
|  | 	$(MKGLUT)/glut_hel12.c \ | ||||||
|  | 	$(MKGLUT)/glut_hel18.c \ | ||||||
|  | 	$(MKGLUT)/glut_tr10.c \ | ||||||
|  | 	$(MKGLUT)/glut_tr24.c \ | ||||||
|  | 	$(MKGLUT)/glut_roman.c \ | ||||||
|  | 	$(MKGLUT)/glut_mroman.c \ | ||||||
|  | 	$(MKGLUT)/glut_util.c | ||||||
|  |  | ||||||
| SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) $(MARK_SOURCES) | SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) $(MKGLUT_SOURCES) | ||||||
|  |  | ||||||
| OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) | OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) | ||||||
|  |  | ||||||
| .c.o: | .c.o: | ||||||
| 	$(CC) -o $@ -c $(CFLAGS) $< | 	$(CC) -o $@ $(CFLAGS) -c $< | ||||||
| .S.o: | .S.o: | ||||||
| 	$(CC) -o $@ -c $(CFLAGS) $< | 	$(CC) -o $@ $(CFLAGS) -c $< | ||||||
| .s.o: | .s.o: | ||||||
| 	$(CC) -o $@ -c $(CFLAGS) -x assembler-with-cpp $< | 	$(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $< | ||||||
|  |  | ||||||
| all: $(LIBDIR)/$(GLUT_LIB) $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP) | all: $(LIBDIR)/$(GLUT_LIB) $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP) | ||||||
|  |  | ||||||
| @@ -121,16 +120,15 @@ $(LIBDIR)/$(GLUT_LIB): $(OBJECTS) | |||||||
| 	$(AR) $(ARFLAGS) $(LIBDIR)/$(GLUT_LIB) $(OBJECTS) | 	$(AR) $(ARFLAGS) $(LIBDIR)/$(GLUT_LIB) $(OBJECTS) | ||||||
|  |  | ||||||
| $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS) | $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS) | ||||||
| ifeq ($(DXE2GEN),) | ifeq ($(HAVEDXE3),) | ||||||
| 	$(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN) | 	$(warning Missing DXE3 package... Skipping $(GLUT_DXE)) | ||||||
| 	$(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.) |  | ||||||
| else | else | ||||||
| 	-dxe2gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) $(OBJECTS) -E djgpp_ -E glut -D "Mesa DJGPP GLUT" -U | 	-dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E _glut -P gl.dxe -P glu.dxe -U $(OBJECTS) | ||||||
| endif | endif | ||||||
|  |  | ||||||
| clean: | clean: | ||||||
| 	-$(RM) $(subst /,\,*.o) | 	-$(call UNLINK,*.o) | ||||||
| 	-$(RM) $(subst /,\,PC_HW/*.o) | 	-$(call UNLINK,PC_HW/*.o) | ||||||
| 	-$(RM) $(subst /,\,$(MARK)/*.o) | 	-$(call UNLINK,$(MKGLUT)/*.o) | ||||||
|  |  | ||||||
| -include depend | -include depend | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * PC/HW routine collection v1.2 for DOS/DJGPP |  * PC/HW routine collection v1.3 for DOS/DJGPP | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -73,21 +73,22 @@ void *pc_malloc (size_t size) | |||||||
| /* | /* | ||||||
|  * standard redirection |  * standard redirection | ||||||
|  */ |  */ | ||||||
| static int h_out, h_outbak, h_err, h_errbak; | static char outname[L_tmpnam]; | ||||||
|  | static int h_out, h_outbak; | ||||||
|  | static char errname[L_tmpnam]; | ||||||
|  | static int h_err, h_errbak; | ||||||
|  |  | ||||||
| int pc_open_stdout (void) | int pc_open_stdout (void) | ||||||
| { | { | ||||||
|  if ((h_out=open(tmpnam(NULL), O_WRONLY | O_CREAT | O_TRUNC | O_TEXT | O_TEMPORARY, S_IRUSR | S_IWUSR)) >= 0) { |  tmpnam(outname); | ||||||
|     if ((h_outbak=dup(1)) != -1) { |  | ||||||
|        fflush(stdout); |  if ((h_out=open(outname, O_WRONLY | O_CREAT | O_TEXT | O_TRUNC, S_IREAD | S_IWRITE)) > 0) { | ||||||
|        if (dup2(h_out, 1) != -1) { |     h_outbak = dup(STDOUT_FILENO); | ||||||
|           return 0; |     fflush(stdout); | ||||||
|        } |     dup2(h_out, STDOUT_FILENO); | ||||||
|        close(h_outbak); |  | ||||||
|     } |  | ||||||
|     close(h_out); |  | ||||||
|  } |  } | ||||||
|  return (h_out = -1); |  | ||||||
|  |  return h_out; | ||||||
| } | } | ||||||
|  |  | ||||||
| void pc_close_stdout (void) | void pc_close_stdout (void) | ||||||
| @@ -95,35 +96,32 @@ void pc_close_stdout (void) | |||||||
|  FILE *f; |  FILE *f; | ||||||
|  char *line = alloca(512); |  char *line = alloca(512); | ||||||
|  |  | ||||||
|  if (h_out >= 0) { |  if (h_out > 0) { | ||||||
|     dup2(h_outbak, 1); |     dup2(h_outbak, STDOUT_FILENO); | ||||||
|  |     close(h_out); | ||||||
|     close(h_outbak); |     close(h_outbak); | ||||||
|  |  | ||||||
|     if ((f=fdopen(h_out, "r")) != NULL) { |     f = fopen(outname, "rt"); | ||||||
|        fseek(f, 0, SEEK_SET); |     while (fgets(line, 512, f)) { | ||||||
|        while (fgets(line, 512, f)) { |           fputs(line, stdout); | ||||||
|              fputs(line, stdout); |  | ||||||
|        } |  | ||||||
|        fclose(f); |  | ||||||
|     } else { |  | ||||||
|        close(h_out); |  | ||||||
|     } |     } | ||||||
|  |     fclose(f); | ||||||
|  |  | ||||||
|  |     remove(outname); | ||||||
|  } |  } | ||||||
| } | } | ||||||
|  |  | ||||||
| int pc_open_stderr (void) | int pc_open_stderr (void) | ||||||
| { | { | ||||||
|  if ((h_err=open(tmpnam(NULL), O_WRONLY | O_CREAT | O_TRUNC | O_TEXT | O_TEMPORARY, S_IRUSR | S_IWUSR)) >= 0) { |  tmpnam(errname); | ||||||
|     if ((h_errbak=dup(2)) != -1) { |  | ||||||
|        fflush(stderr); |  if ((h_err=open(errname, O_WRONLY | O_CREAT | O_TEXT | O_TRUNC, S_IREAD | S_IWRITE)) > 0) { | ||||||
|        if (dup2(h_err, 2) != -1) { |     h_errbak = dup(STDERR_FILENO); | ||||||
|           return 0; |     fflush(stderr); | ||||||
|        } |     dup2(h_err, STDERR_FILENO); | ||||||
|        close(h_errbak); |  | ||||||
|     } |  | ||||||
|     close(h_err); |  | ||||||
|  } |  } | ||||||
|  return (h_err = -1); |  | ||||||
|  |  return h_err; | ||||||
| } | } | ||||||
|  |  | ||||||
| void pc_close_stderr (void) | void pc_close_stderr (void) | ||||||
| @@ -131,18 +129,17 @@ void pc_close_stderr (void) | |||||||
|  FILE *f; |  FILE *f; | ||||||
|  char *line = alloca(512); |  char *line = alloca(512); | ||||||
|  |  | ||||||
|  if (h_err >= 0) { |  if (h_err > 0) { | ||||||
|     dup2(h_errbak, 2); |     dup2(h_errbak, STDERR_FILENO); | ||||||
|  |     close(h_err); | ||||||
|     close(h_errbak); |     close(h_errbak); | ||||||
|  |  | ||||||
|     if ((f=fdopen(h_err, "r")) != NULL) { |     f = fopen(errname, "rt"); | ||||||
|        fseek(f, 0, SEEK_SET); |     while (fgets(line, 512, f)) { | ||||||
|        while (fgets(line, 512, f)) { |           fputs(line, stderr); | ||||||
|              fputs(line, stderr); |  | ||||||
|        } |  | ||||||
|        fclose(f); |  | ||||||
|     } else { |  | ||||||
|        close(h_err); |  | ||||||
|     } |     } | ||||||
|  |     fclose(f); | ||||||
|  |  | ||||||
|  |     remove(errname); | ||||||
|  } |  } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * PC/HW routine collection v1.2 for DOS/DJGPP |  * PC/HW routine collection v1.3 for DOS/DJGPP | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -25,7 +25,7 @@ | |||||||
|  |  | ||||||
| typedef void (*VFUNC) (void); | typedef void (*VFUNC) (void); | ||||||
| typedef void (*PFUNC) (void *); | typedef void (*PFUNC) (void *); | ||||||
| typedef void (*MFUNC) (int x, int y, int b); | typedef void (*MFUNC) (int x, int y, int z, int b); | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * atexit |  * atexit | ||||||
| @@ -39,6 +39,7 @@ int pc_clexit (VFUNC f); | |||||||
| #define ENDOFUNC(x)    static void x##_end() { } | #define ENDOFUNC(x)    static void x##_end() { } | ||||||
| #define LOCKFUNC(x)    _go32_dpmi_lock_code((void *)x, (long)x##_end - (long)x) | #define LOCKFUNC(x)    _go32_dpmi_lock_code((void *)x, (long)x##_end - (long)x) | ||||||
| #define LOCKDATA(x)    _go32_dpmi_lock_data((void *)&x, sizeof(x)) | #define LOCKDATA(x)    _go32_dpmi_lock_data((void *)&x, sizeof(x)) | ||||||
|  | #define LOCKBUFF(x, l) _go32_dpmi_lock_data((void *)x, l) | ||||||
|  |  | ||||||
| void *pc_malloc (size_t size); | void *pc_malloc (size_t size); | ||||||
|  |  | ||||||
| @@ -194,6 +195,7 @@ void pc_remove_keyb (void); | |||||||
| int pc_keypressed (void); | int pc_keypressed (void); | ||||||
| int pc_readkey (void); | int pc_readkey (void); | ||||||
| int pc_keydown (int code); | int pc_keydown (int code); | ||||||
|  | int pc_keyshifts (void); | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * timer |  * timer | ||||||
| @@ -209,10 +211,8 @@ void pc_remove_mouse (void); | |||||||
| MFUNC pc_install_mouse_handler (MFUNC handler); | MFUNC pc_install_mouse_handler (MFUNC handler); | ||||||
| void pc_mouse_area (int x1, int y1, int x2, int y2); | void pc_mouse_area (int x1, int y1, int x2, int y2); | ||||||
| void pc_mouse_speed (int xspeed, int yspeed); | void pc_mouse_speed (int xspeed, int yspeed); | ||||||
| int pc_query_mouse (int *x, int *y); | int pc_query_mouse (int *x, int *y, int *z); | ||||||
| void pc_show_mouse (void); | void pc_warp_mouse (int x, int y); | ||||||
| void pc_scare_mouse (void); |  | ||||||
| void pc_unscare_mouse (void); |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * standard redirection |  * standard redirection | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * PC/HW routine collection v1.0 for DOS/DJGPP |  * PC/HW routine collection v1.3 for DOS/DJGPP | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -74,6 +74,9 @@ _pc_install_irq: | |||||||
| 		addl	%edx, %eax | 		addl	%edx, %eax | ||||||
| 		movl	%eax, IRQ_STACK(%edi) | 		movl	%eax, IRQ_STACK(%edi) | ||||||
|  |  | ||||||
|  | 		movl	___djgpp_ds_alias, %eax | ||||||
|  | 		movl	%eax, IRQ_STACK+4(%edi) | ||||||
|  |  | ||||||
| 		movl	%ss:12(%ebp), %eax | 		movl	%ss:12(%ebp), %eax | ||||||
| 		movl	%eax, IRQ_HOOK(%edi) | 		movl	%eax, IRQ_HOOK(%edi) | ||||||
|  |  | ||||||
| @@ -131,8 +134,7 @@ __irq_wrapper_##x:							   ; \ | |||||||
| 		pushl	%gs						   ; \ | 		pushl	%gs						   ; \ | ||||||
| 		movl	%ss, %ebx					   ; \ | 		movl	%ss, %ebx					   ; \ | ||||||
| 		movl	%esp, %esi					   ; \ | 		movl	%esp, %esi					   ; \ | ||||||
| 		movl	%cs:___djgpp_ds_alias, %ss			   ; \ | 		lss	%cs:__irq_stack_##x, %esp			   ; \ | ||||||
| 		movl	%cs:__irq_stack_##x, %esp			   ; \ |  | ||||||
| 		pushl	%ss						   ; \ | 		pushl	%ss						   ; \ | ||||||
| 		pushl	%ss						   ; \ | 		pushl	%ss						   ; \ | ||||||
| 		popl	%es						   ; \ | 		popl	%es						   ; \ | ||||||
| @@ -160,7 +162,7 @@ __irq_old_##x:								   ; \ | |||||||
| __irq_hook_##x:								   ; \ | __irq_hook_##x:								   ; \ | ||||||
| 		.long	0						   ; \ | 		.long	0						   ; \ | ||||||
| __irq_stack_##x:							   ; \ | __irq_stack_##x:							   ; \ | ||||||
| 		.long	0 | 		.long	0, 0 | ||||||
|  |  | ||||||
| 		WRAPPER(0); | 		WRAPPER(0); | ||||||
| 		WRAPPER(1); | 		WRAPPER(1); | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * PC/HW routine collection v1.1 for DOS/DJGPP |  * PC/HW routine collection v1.3 for DOS/DJGPP | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -357,20 +357,6 @@ static void handle_code (int scancode, int keycode) | |||||||
|  in_a_terrupt--; |  in_a_terrupt--; | ||||||
| } ENDOFUNC(handle_code) | } ENDOFUNC(handle_code) | ||||||
|  |  | ||||||
| static __inline void satisfy (void) |  | ||||||
| { |  | ||||||
|  __asm("\n\ |  | ||||||
| 		inb	$0x61, %%al	\n\ |  | ||||||
| 		movb	%%al, %%ah	\n\ |  | ||||||
| 		orb	$0x80, %%al	\n\ |  | ||||||
| 		outb	%%al, $0x61	\n\ |  | ||||||
| 		xchgb	%%al, %%ah	\n\ |  | ||||||
| 		outb	%%al, $0x61	\n\ |  | ||||||
| 		movb	$0x20, %%al	\n\ |  | ||||||
| 		outb	%%al, $0x20	\n\ |  | ||||||
|  ":::"%eax"); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static int keyboard () | static int keyboard () | ||||||
| { | { | ||||||
|  unsigned char temp, scancode; |  unsigned char temp, scancode; | ||||||
| @@ -410,7 +396,16 @@ static int keyboard () | |||||||
|     ":::"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); |     ":::"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); | ||||||
|  } |  } | ||||||
|  |  | ||||||
|  satisfy(); |  __asm("\n\ | ||||||
|  | 		inb	$0x61, %%al	\n\ | ||||||
|  | 		movb	%%al, %%ah	\n\ | ||||||
|  | 		orb	$0x80, %%al	\n\ | ||||||
|  | 		outb	%%al, $0x61	\n\ | ||||||
|  | 		xchgb	%%al, %%ah	\n\ | ||||||
|  | 		outb	%%al, $0x61	\n\ | ||||||
|  | 		movb	$0x20, %%al	\n\ | ||||||
|  | 		outb	%%al, $0x20	\n\ | ||||||
|  |  ":::"%eax"); | ||||||
|  return 0; |  return 0; | ||||||
| } ENDOFUNC(keyboard) | } ENDOFUNC(keyboard) | ||||||
|  |  | ||||||
| @@ -425,8 +420,9 @@ int pc_readkey (void) | |||||||
|  if (keyboard_installed) { |  if (keyboard_installed) { | ||||||
|     int key; |     int key; | ||||||
|  |  | ||||||
|     do { |     while (key_buffer.start==key_buffer.end) { | ||||||
|     } while (key_buffer.start==key_buffer.end); |           __dpmi_yield(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     DISABLE(); |     DISABLE(); | ||||||
|     key = key_buffer.key[key_buffer.start++]; |     key = key_buffer.key[key_buffer.start++]; | ||||||
| @@ -445,6 +441,11 @@ int pc_keydown (int code) | |||||||
|  return pc_key[code]; |  return pc_key[code]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int pc_keyshifts (void) | ||||||
|  | { | ||||||
|  |  return key_shifts; | ||||||
|  | } | ||||||
|  |  | ||||||
| void pc_remove_keyb (void) | void pc_remove_keyb (void) | ||||||
| { | { | ||||||
|  if (keyboard_installed) { |  if (keyboard_installed) { | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * PC/HW routine collection v1.2 for DOS/DJGPP |  * PC/HW routine collection v1.3 for DOS/DJGPP | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -8,11 +8,15 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| #include <dpmi.h> | #include <dpmi.h> | ||||||
|  | #include <sys/exceptn.h> | ||||||
|  | #include <sys/segments.h> | ||||||
|  |  | ||||||
| #include "pc_hw.h" | #include "pc_hw.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #define PC_CUTE_WHEEL 1 /* CuteMouse WheelAPI */ | ||||||
|  |  | ||||||
| #define MOUSE_STACK_SIZE 16384 | #define MOUSE_STACK_SIZE 16384 | ||||||
|  |  | ||||||
| #define CLEAR_MICKEYS() \ | #define CLEAR_MICKEYS() \ | ||||||
| @@ -21,20 +25,23 @@ | |||||||
|             ox = oy = 0; \ |             ox = oy = 0; \ | ||||||
|         } while (0) |         } while (0) | ||||||
|  |  | ||||||
| extern void mouse_wrapper (void); | extern void mouse_wrap (void); | ||||||
| extern void mouse_wrapper_end (void); | extern int mouse_wrap_end[]; | ||||||
|  |  | ||||||
| static MFUNC mouse_func; | static MFUNC mouse_func; | ||||||
| static void *mouse_stack; |  | ||||||
| static long mouse_callback; | static long mouse_callback; | ||||||
| static __dpmi_regs mouse_regs; | static __dpmi_regs mouse_regs; | ||||||
|  |  | ||||||
| static volatile int pc_mouse_x, pc_mouse_y, pc_mouse_b; | static volatile struct { | ||||||
|  |        volatile int x, y, z, b; | ||||||
|  | } pc_mouse; | ||||||
|  |  | ||||||
| static int minx = 0; | static int minx = 0; | ||||||
| static int maxx = 319; | static int maxx = 319; | ||||||
| static int miny = 0; | static int miny = 0; | ||||||
| static int maxy = 199; | static int maxy = 199; | ||||||
|  | static int minz = 0; | ||||||
|  | static int maxz = 255; | ||||||
|  |  | ||||||
| static int sx = 2; | static int sx = 2; | ||||||
| static int sy = 2; | static int sy = 2; | ||||||
| @@ -43,27 +50,34 @@ static int emulat3 = FALSE; | |||||||
|  |  | ||||||
| static int ox, oy; | static int ox, oy; | ||||||
|  |  | ||||||
|  |  | ||||||
| static void mouse (__dpmi_regs *r) | static void mouse (__dpmi_regs *r) | ||||||
| { | { | ||||||
|  int nx = (signed short)r->x.si / sx; |  int nx = (signed short)r->x.si / sx; | ||||||
|  int ny = (signed short)r->x.di / sy; |  int ny = (signed short)r->x.di / sy; | ||||||
|  int dx = nx - ox; |  int dx = nx - ox; | ||||||
|  int dy = ny - oy; |  int dy = ny - oy; | ||||||
|  | #if PC_CUTE_WHEEL | ||||||
|  |  int dz = (signed char)r->h.bh; | ||||||
|  | #endif | ||||||
|  ox = nx; |  ox = nx; | ||||||
|  oy = ny; |  oy = ny; | ||||||
|  |  | ||||||
|  pc_mouse_b = r->x.bx; |  pc_mouse.b = r->h.bl; | ||||||
|  pc_mouse_x = MID(minx, pc_mouse_x + dx, maxx); |  pc_mouse.x = MID(minx, pc_mouse.x + dx, maxx); | ||||||
|  pc_mouse_y = MID(miny, pc_mouse_y + dy, maxy); |  pc_mouse.y = MID(miny, pc_mouse.y + dy, maxy); | ||||||
|  | #if PC_CUTE_WHEEL | ||||||
|  |  pc_mouse.z = MID(minz, pc_mouse.z + dz, maxz); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  if (emulat3) { |  if (emulat3) { | ||||||
|     if ((pc_mouse_b&3)==3) { |     if ((pc_mouse.b&3)==3) { | ||||||
|        pc_mouse_b = 4; |        pc_mouse.b = 4; | ||||||
|     } |     } | ||||||
|  } |  } | ||||||
|  |  | ||||||
|  if (mouse_func) { |  if (mouse_func) { | ||||||
|     mouse_func(pc_mouse_x, pc_mouse_y, pc_mouse_b); |     mouse_func(pc_mouse.x, pc_mouse.y, pc_mouse.z, pc_mouse.b); | ||||||
|  } |  } | ||||||
| } ENDOFUNC(mouse) | } ENDOFUNC(mouse) | ||||||
|  |  | ||||||
| @@ -83,7 +97,7 @@ void pc_remove_mouse (void) | |||||||
|  |  | ||||||
|     mouse_callback = 0; |     mouse_callback = 0; | ||||||
|  |  | ||||||
|     free((void *)((unsigned long)mouse_stack-MOUSE_STACK_SIZE)); |     free((void *)(mouse_wrap_end[0] - MOUSE_STACK_SIZE)); | ||||||
|  } |  } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -109,26 +123,26 @@ int pc_install_mouse (void) | |||||||
|  |  | ||||||
|  /* lock wrapper */ |  /* lock wrapper */ | ||||||
|  LOCKDATA(mouse_func); |  LOCKDATA(mouse_func); | ||||||
|  LOCKDATA(mouse_stack); |  | ||||||
|  LOCKDATA(mouse_callback); |  LOCKDATA(mouse_callback); | ||||||
|  LOCKDATA(mouse_regs); |  LOCKDATA(mouse_regs); | ||||||
|  LOCKDATA(pc_mouse_x); |  LOCKDATA(pc_mouse); | ||||||
|  LOCKDATA(pc_mouse_y); |  | ||||||
|  LOCKDATA(pc_mouse_b); |  | ||||||
|  LOCKDATA(minx); |  LOCKDATA(minx); | ||||||
|  LOCKDATA(maxx); |  LOCKDATA(maxx); | ||||||
|  LOCKDATA(miny); |  LOCKDATA(miny); | ||||||
|  LOCKDATA(maxy); |  LOCKDATA(maxy); | ||||||
|  |  LOCKDATA(minz); | ||||||
|  |  LOCKDATA(maxz); | ||||||
|  LOCKDATA(sx); |  LOCKDATA(sx); | ||||||
|  LOCKDATA(sy); |  LOCKDATA(sy); | ||||||
|  LOCKDATA(emulat3); |  LOCKDATA(emulat3); | ||||||
|  LOCKDATA(ox); |  LOCKDATA(ox); | ||||||
|  LOCKDATA(oy); |  LOCKDATA(oy); | ||||||
|  LOCKFUNC(mouse); |  LOCKFUNC(mouse); | ||||||
|  LOCKFUNC(mouse_wrapper); |  LOCKFUNC(mouse_wrap); | ||||||
|  |  | ||||||
|  |  mouse_wrap_end[1] = __djgpp_ds_alias; | ||||||
|  /* grab a locked stack */ |  /* grab a locked stack */ | ||||||
|  if ((mouse_stack=pc_malloc(MOUSE_STACK_SIZE))==NULL) { |  if ((mouse_wrap_end[0] = (int)pc_malloc(MOUSE_STACK_SIZE)) == NULL) { | ||||||
|     return 0; |     return 0; | ||||||
|  } |  } | ||||||
|  |  | ||||||
| @@ -150,19 +164,23 @@ int pc_install_mouse (void) | |||||||
| 		movl	%%ecx, %0	\n\ | 		movl	%%ecx, %0	\n\ | ||||||
| 	0:				\n\ | 	0:				\n\ | ||||||
|  ":"=g"(mouse_callback) |  ":"=g"(mouse_callback) | ||||||
|   :"S" (mouse_wrapper), "D"(&mouse_regs) |   :"S" (mouse_wrap), "D"(&mouse_regs) | ||||||
|   :"%eax", "%ecx", "%edx"); |   :"%eax", "%ecx", "%edx"); | ||||||
|  if (!mouse_callback) { |  if (!mouse_callback) { | ||||||
|     free(mouse_stack); |     free((void *)mouse_wrap_end[0]); | ||||||
|     return 0; |     return 0; | ||||||
|  } |  } | ||||||
|  |  | ||||||
|  /* adjust stack */ |  /* adjust stack */ | ||||||
|  mouse_stack = (void *)((unsigned long)mouse_stack + MOUSE_STACK_SIZE); |  mouse_wrap_end[0] += MOUSE_STACK_SIZE; | ||||||
|  |  | ||||||
|  /* install the handler */ |  /* install the handler */ | ||||||
|  mouse_regs.x.ax = 0x000c; |  mouse_regs.x.ax = 0x000c; | ||||||
|  mouse_regs.x.cx = 0x007f; | #if PC_CUTE_WHEEL | ||||||
|  |  mouse_regs.x.cx = 0x7f | 0x80; | ||||||
|  | #else | ||||||
|  |  mouse_regs.x.cx = 0x7f; | ||||||
|  | #endif | ||||||
|  mouse_regs.x.dx = mouse_callback&0xffff; |  mouse_regs.x.dx = mouse_callback&0xffff; | ||||||
|  mouse_regs.x.es = mouse_callback>>16; |  mouse_regs.x.es = mouse_callback>>16; | ||||||
|  __dpmi_int(0x33, &mouse_regs); |  __dpmi_int(0x33, &mouse_regs); | ||||||
| @@ -205,54 +223,56 @@ void pc_mouse_speed (int xspeed, int yspeed) | |||||||
|  ENABLE(); |  ENABLE(); | ||||||
| } | } | ||||||
|  |  | ||||||
| int pc_query_mouse (int *x, int *y) | int pc_query_mouse (int *x, int *y, int *z) | ||||||
| { | { | ||||||
|  *x = pc_mouse_x; |  *x = pc_mouse.x; | ||||||
|  *y = pc_mouse_y; |  *y = pc_mouse.y; | ||||||
|  return pc_mouse_b; |  *z = pc_mouse.z; | ||||||
|  |  return pc_mouse.b; | ||||||
| } | } | ||||||
|  |  | ||||||
| void pc_show_mouse (void) | void pc_warp_mouse (int x, int y) | ||||||
| { | { | ||||||
|  /* not implemented */ |  CLEAR_MICKEYS(); | ||||||
| } |  | ||||||
| void pc_scare_mouse (void) |  pc_mouse.x = MID(minx, x, maxx); | ||||||
| { |  pc_mouse.y = MID(miny, y, maxy); | ||||||
|  /* not implemented */ |  | ||||||
| } |  if (mouse_func) { | ||||||
| void pc_unscare_mouse (void) |     mouse_func(pc_mouse.x, pc_mouse.y, pc_mouse.z, pc_mouse.b); | ||||||
| { |  } | ||||||
|  /* not implemented */ |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /* Hack alert: | ||||||
|  |  * `mouse_wrap_end' actually holds the | ||||||
|  |  * address of stack in a safe data selector. | ||||||
|  |  */ | ||||||
| __asm("\n\ | __asm("\n\ | ||||||
| 		.text					\n\ | 		.text				\n\ | ||||||
| 		.balign	4				\n\ | 		.p2align 5,,31			\n\ | ||||||
| 		.global	_mouse_wrapper			\n\ | 		.global	_mouse_wrap		\n\ | ||||||
| _mouse_wrapper:						\n\ | _mouse_wrap:					\n\ | ||||||
| 		cld					\n\ | 		cld				\n\ | ||||||
| 		lodsl					\n\ | 		lodsl				\n\ | ||||||
| 		movl	%eax, %es:42(%edi)		\n\ | 		movl	%eax, %es:42(%edi)	\n\ | ||||||
| 		addw	$4, %es:46(%edi)		\n\ | 		addw	$4, %es:46(%edi)	\n\ | ||||||
| 		pushl	%es				\n\ | 		pushl	%es			\n\ | ||||||
| 		movl	%ss, %ebx			\n\ | 		movl	%ss, %ebx		\n\ | ||||||
| 		movl	%esp, %esi			\n\ | 		movl	%esp, %esi		\n\ | ||||||
| 		movl	%cs:___djgpp_ds_alias, %ss	\n\ | 		lss	%cs:_mouse_wrap_end, %esp\n\ | ||||||
| 		movl	%cs:_mouse_stack, %esp		\n\ | 		pushl	%ss			\n\ | ||||||
| 		pushl	%ss				\n\ | 		pushl	%ss			\n\ | ||||||
| 		pushl	%ss				\n\ | 		popl	%es			\n\ | ||||||
| 		popl	%es				\n\ | 		popl	%ds			\n\ | ||||||
| 		popl	%ds				\n\ | 		movl	___djgpp_dos_sel, %fs	\n\ | ||||||
| 		movl	___djgpp_dos_sel, %fs		\n\ | 		pushl	%fs			\n\ | ||||||
| 		pushl	%fs				\n\ | 		popl	%gs			\n\ | ||||||
| 		popl	%gs				\n\ | 		pushl	%edi			\n\ | ||||||
| 		pushl	%edi				\n\ | 		call	_mouse			\n\ | ||||||
| 		call	_mouse				\n\ | 		popl	%edi			\n\ | ||||||
| 		popl	%edi				\n\ | 		movl	%ebx, %ss		\n\ | ||||||
| 		movl	%ebx, %ss			\n\ | 		movl	%esi, %esp		\n\ | ||||||
| 		movl	%esi, %esp			\n\ | 		popl	%es			\n\ | ||||||
| 		popl	%es				\n\ | 		iret				\n\ | ||||||
| 		iret					\n\ | 		.global	_mouse_wrap_end		\n\ | ||||||
| 		.balign	4				\n\ | _mouse_wrap_end:.long	0, 0"); | ||||||
| 		.global	_mouse_wrapper_end		\n\ |  | ||||||
| _mouse_wrapper_end:"); |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * PC/HW routine collection v1.0 for DOS/DJGPP |  * PC/HW routine collection v1.3 for DOS/DJGPP | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -27,7 +27,7 @@ typedef struct { | |||||||
|         volatile void *parm; |         volatile void *parm; | ||||||
| } TIMER; | } TIMER; | ||||||
|  |  | ||||||
| TIMER timer_main, timer_func[MAX_TIMERS]; | static TIMER timer_main, timer_func[MAX_TIMERS]; | ||||||
|  |  | ||||||
| static int timer () | static int timer () | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,56 +0,0 @@ | |||||||
|  |  | ||||||
| /* Copyright (c) Mark J. Kilgard, 1994. */ |  | ||||||
|  |  | ||||||
| /* This program is freely distributable without licensing fees |  | ||||||
|    and is provided without guarantee or warrantee expressed or |  | ||||||
|    implied. This program is -not- in the public domain. */ |  | ||||||
|  |  | ||||||
| #include "glutbitmap.h" |  | ||||||
|  |  | ||||||
| void APIENTRY  |  | ||||||
| glutBitmapCharacter(GLUTbitmapFont font, int c) |  | ||||||
| { |  | ||||||
|   const BitmapCharRec *ch; |  | ||||||
|   BitmapFontPtr fontinfo; |  | ||||||
|   GLint swapbytes, lsbfirst, rowlength; |  | ||||||
|   GLint skiprows, skippixels, alignment; |  | ||||||
|  |  | ||||||
| #if defined(_WIN32) |  | ||||||
|   fontinfo = (BitmapFontPtr) __glutFont(font); |  | ||||||
| #else |  | ||||||
|   fontinfo = (BitmapFontPtr) font; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|   if (c < fontinfo->first || |  | ||||||
|     c >= fontinfo->first + fontinfo->num_chars) |  | ||||||
|     return; |  | ||||||
|   ch = fontinfo->ch[c - fontinfo->first]; |  | ||||||
|   if (ch) { |  | ||||||
|     /* Save current modes. */ |  | ||||||
|     glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes); |  | ||||||
|     glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst); |  | ||||||
|     glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength); |  | ||||||
|     glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows); |  | ||||||
|     glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels); |  | ||||||
|     glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); |  | ||||||
|     /* Little endian machines (DEC Alpha for example) could |  | ||||||
|        benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE |  | ||||||
|        instead of GL_FALSE, but this would require changing the |  | ||||||
|        generated bitmaps too. */ |  | ||||||
|     glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); |  | ||||||
|     glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); |  | ||||||
|     glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); |  | ||||||
|     glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); |  | ||||||
|     glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); |  | ||||||
|     glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |  | ||||||
|     glBitmap(ch->width, ch->height, ch->xorig, ch->yorig, |  | ||||||
|       ch->advance, 0, ch->bitmap); |  | ||||||
|     /* Restore saved modes. */ |  | ||||||
|     glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes); |  | ||||||
|     glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst); |  | ||||||
|     glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength); |  | ||||||
|     glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows); |  | ||||||
|     glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels); |  | ||||||
|     glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @@ -19,7 +19,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * DOS/DJGPP glut driver v1.0 for Mesa 4.0 |  * DOS/DJGPP glut driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -27,126 +27,138 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "GL/glut.h" | #include "glutint.h" | ||||||
| #include "internal.h" |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutDisplayFunc (void (GLUTCALLBACK *func) (void)) |  | ||||||
|  | GLUTidleCB g_idle_func = NULL; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutDisplayFunc (GLUTdisplayCB func) | ||||||
| { | { | ||||||
|  display_func = func; |  g_curwin->display = func; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutReshapeFunc (void (GLUTCALLBACK *func) (int width, int height)) |  | ||||||
|  | void APIENTRY glutReshapeFunc (GLUTreshapeCB func) | ||||||
| { | { | ||||||
|  reshape_func = func; |  g_curwin->reshape = func; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutKeyboardFunc (void (GLUTCALLBACK *func) (unsigned char key, int x, int y)) |  | ||||||
|  | void APIENTRY glutKeyboardFunc (GLUTkeyboardCB func) | ||||||
| { | { | ||||||
|  keyboard_func = func; |  g_curwin->keyboard = func; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutMouseFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y)) |  | ||||||
|  | void APIENTRY glutMouseFunc (GLUTmouseCB func) | ||||||
| { | { | ||||||
|  mouse_func = func; |  g_curwin->mouse = func; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutMotionFunc (void (GLUTCALLBACK *func) (int x, int y)) |  | ||||||
|  | void APIENTRY glutMotionFunc (GLUTmotionCB func) | ||||||
| { | { | ||||||
|  motion_func = func; |  g_curwin->motion = func; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutPassiveMotionFunc (void (GLUTCALLBACK *func) (int x, int y)) |  | ||||||
|  | void APIENTRY glutPassiveMotionFunc (GLUTpassiveCB func) | ||||||
| { | { | ||||||
|  passive_motion_func = func; |  g_curwin->passive = func; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutEntryFunc (void (GLUTCALLBACK *func) (int state)) |  | ||||||
|  | void APIENTRY glutEntryFunc (GLUTentryCB func) | ||||||
| { | { | ||||||
|  entry_func = func; |  g_curwin->entry = func; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutVisibilityFunc (void (GLUTCALLBACK *func) (int state)) |  | ||||||
|  | void APIENTRY glutVisibilityFunc (GLUTvisibilityCB func) | ||||||
| { | { | ||||||
|  visibility_func = func; |  g_curwin->visibility = func; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutIdleFunc (void (GLUTCALLBACK *func) (void)) |  | ||||||
| { |  | ||||||
|  idle_func = func; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutWindowStatusFunc (GLUTwindowStatusCB func) | ||||||
| void APIENTRY glutTimerFunc (unsigned int millis, void (GLUTCALLBACK *func) (int value), int value) |  | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutMenuStateFunc (void (GLUTCALLBACK *func) (int state)) |  | ||||||
|  | void APIENTRY glutIdleFunc (GLUTidleCB func) | ||||||
| { | { | ||||||
|  menu_state_func = func; |  g_idle_func = func; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutSpecialFunc (void (GLUTCALLBACK *func) (int key, int x, int y)) |  | ||||||
| { |  | ||||||
|  special_func = func; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutTimerFunc (unsigned int millis, GLUTtimerCB func, int value) | ||||||
| void APIENTRY glutSpaceballMotionFunc (void (GLUTCALLBACK *func) (int x, int y, int z)) |  | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutSpaceballRotateFunc (void (GLUTCALLBACK *func) (int x, int y, int z)) |  | ||||||
|  | void APIENTRY glutSpecialFunc (GLUTspecialCB func) | ||||||
|  | { | ||||||
|  |  g_curwin->special = func; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutSpaceballMotionFunc (GLUTspaceMotionCB func) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutSpaceballButtonFunc (void (GLUTCALLBACK *func) (int button, int state)) |  | ||||||
|  | void APIENTRY glutSpaceballRotateFunc (GLUTspaceRotateCB func) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutButtonBoxFunc (void (GLUTCALLBACK *func) (int button, int state)) |  | ||||||
|  | void APIENTRY glutSpaceballButtonFunc (GLUTspaceButtonCB func) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutDialsFunc (void (GLUTCALLBACK *func) (int dial, int value)) |  | ||||||
|  | void APIENTRY glutDialsFunc (GLUTdialsCB func) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutTabletMotionFunc (void (GLUTCALLBACK *func) (int x, int y)) |  | ||||||
|  | void APIENTRY glutButtonBoxFunc (GLUTbuttonBoxCB func) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutTabletButtonFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y)) |  | ||||||
|  | void APIENTRY glutTabletMotionFunc (GLUTtabletMotionCB func) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutMenuStatusFunc (void (GLUTCALLBACK *func) (int status, int x, int y)) |  | ||||||
|  | void APIENTRY glutTabletButtonFunc (GLUTtabletButtonCB func) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutOverlayDisplayFunc (void (GLUTCALLBACK *func) (void)) |  | ||||||
| { | void APIENTRY glutJoystickFunc (GLUTjoystickCB func, int interval) | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutWindowStatusFunc (void (GLUTCALLBACK *func) (int state)) |  | ||||||
| { | { | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * DOS/DJGPP glut driver v1.0 for Mesa 4.0 |  * DOS/DJGPP glut driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -27,20 +27,33 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "GL/glut.h" | #include "glutint.h" | ||||||
|  | #include "GL/dmesa.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i))) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutSetColor (int ndx, GLfloat red, GLfloat green, GLfloat blue) | void APIENTRY glutSetColor (int ndx, GLfloat red, GLfloat green, GLfloat blue) | ||||||
| { | { | ||||||
|  |  if (g_display_mode & GLUT_INDEX) { | ||||||
|  |     if ((ndx >= 0) && (ndx < (256 - RESERVED_COLORS))) { | ||||||
|  |        DMesaSetCI(ndx, CLAMP(red), CLAMP(green), CLAMP(blue)); | ||||||
|  |     } | ||||||
|  |  } | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| GLfloat APIENTRY glutGetColor (int ndx, int component) | GLfloat APIENTRY glutGetColor (int ndx, int component) | ||||||
| { | { | ||||||
|  return 0.0; |  return 0.0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutCopyColormap (int win) | void APIENTRY glutCopyColormap (int win) | ||||||
| { | { | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										63
									
								
								src/glut/dos/extens.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								src/glut/dos/extens.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  3.4 | ||||||
|  |  * Copyright (C) 1995-1998  Brian Paul | ||||||
|  |  * | ||||||
|  |  * This library is free software; you can redistribute it and/or | ||||||
|  |  * modify it under the terms of the GNU Library General Public | ||||||
|  |  * License as published by the Free Software Foundation; either | ||||||
|  |  * version 2 of the License, or (at your option) any later version. | ||||||
|  |  * | ||||||
|  |  * This library is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  |  * Library General Public License for more details. | ||||||
|  |  * | ||||||
|  |  * You should have received a copy of the GNU Library General Public | ||||||
|  |  * License along with this library; if not, write to the Free | ||||||
|  |  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP glut driver v1.3 for Mesa | ||||||
|  |  * | ||||||
|  |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #include <string.h> | ||||||
|  |  | ||||||
|  | #include "GL/glut.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | int APIENTRY glutExtensionSupported (const char *extension) | ||||||
|  | { | ||||||
|  |  static const GLubyte *extensions = NULL; | ||||||
|  |  const GLubyte *last, *where; | ||||||
|  |  | ||||||
|  |  /* Extension names should not have spaces. */ | ||||||
|  |  if (strchr(extension, ' ') || *extension == '\0') { | ||||||
|  |     return GL_FALSE; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  /* Not my problem if you don't have a valid OpenGL context */ | ||||||
|  |  if (!extensions) { | ||||||
|  |     extensions = glGetString(GL_EXTENSIONS); | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  /* Take care of sub-strings etc. */ | ||||||
|  |  for (last = extensions;;) { | ||||||
|  |      if ((where = (GLubyte *)strstr((const char *)last, extension)) == NULL) { | ||||||
|  |         return GL_FALSE; | ||||||
|  |      } | ||||||
|  |      last = where + strlen(extension); | ||||||
|  |      if (where == extensions || *(where - 1) == ' ') { | ||||||
|  |         if (*last == ' ' || *last == '\0') { | ||||||
|  |            return GL_TRUE; | ||||||
|  |         } | ||||||
|  |      } | ||||||
|  |  } | ||||||
|  | } | ||||||
| @@ -1,61 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Mesa 3-D graphics library |  | ||||||
|  * Version:  3.4 |  | ||||||
|  * Copyright (C) 1995-1998  Brian Paul |  | ||||||
|  * |  | ||||||
|  * This library is free software; you can redistribute it and/or |  | ||||||
|  * modify it under the terms of the GNU Library General Public |  | ||||||
|  * License as published by the Free Software Foundation; either |  | ||||||
|  * version 2 of the License, or (at your option) any later version. |  | ||||||
|  * |  | ||||||
|  * This library is distributed in the hope that it will be useful, |  | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  | ||||||
|  * Library General Public License for more details. |  | ||||||
|  * |  | ||||||
|  * You should have received a copy of the GNU Library General Public |  | ||||||
|  * License along with this library; if not, write to the Free |  | ||||||
|  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * DOS/DJGPP glut driver v1.0 for Mesa 4.0 |  | ||||||
|  * |  | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  | ||||||
|  *  Email : dborca@yahoo.com |  | ||||||
|  *  Web   : http://www.geocities.com/dborca |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "GL/glut.h" |  | ||||||
| #include "internal.h" |  | ||||||
|  |  | ||||||
| GLenum    g_display_mode = 0; |  | ||||||
| GLuint    g_width        = DEFAULT_WIDTH; |  | ||||||
| GLuint    g_height       = DEFAULT_HEIGHT; |  | ||||||
| GLint     g_mouse        = GL_FALSE; |  | ||||||
| GLboolean g_redisplay    = GL_FALSE; |  | ||||||
| GLint     g_xpos         = 0; |  | ||||||
| GLint     g_ypos         = 0; |  | ||||||
|  |  | ||||||
| void (GLUTCALLBACK *display_func) (void)                              = NULL; |  | ||||||
| void (GLUTCALLBACK *reshape_func) (int width, int height)             = NULL; |  | ||||||
| void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y)  = NULL; |  | ||||||
| void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y) = NULL; |  | ||||||
| void (GLUTCALLBACK *motion_func) (int x, int y)                       = NULL; |  | ||||||
| void (GLUTCALLBACK *passive_motion_func) (int x, int y)               = NULL; |  | ||||||
| void (GLUTCALLBACK *entry_func) (int state)                           = NULL; |  | ||||||
| void (GLUTCALLBACK *visibility_func) (int state)                      = NULL; |  | ||||||
| void (GLUTCALLBACK *idle_func) (void)                                 = NULL; |  | ||||||
| void (GLUTCALLBACK *menu_state_func) (int state)                      = NULL; |  | ||||||
| void (GLUTCALLBACK *special_func) (int key, int x, int y)             = NULL; |  | ||||||
| void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z)      = NULL; |  | ||||||
| void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z)      = NULL; |  | ||||||
| void (GLUTCALLBACK *spaceball_button_func) (int button, int state)    = NULL; |  | ||||||
| void (GLUTCALLBACK *button_box_func) (int button, int state)          = NULL; |  | ||||||
| void (GLUTCALLBACK *dials_func) (int dial, int value)                 = NULL; |  | ||||||
| void (GLUTCALLBACK *tablet_motion_func) (int x, int y)                = NULL; |  | ||||||
| void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y) = NULL; |  | ||||||
| void (GLUTCALLBACK *menu_status_func) (int status, int x, int y)      = NULL; |  | ||||||
| void (GLUTCALLBACK *overlay_display_func) (void)                      = NULL; |  | ||||||
| void (GLUTCALLBACK *window_status_func) (int state)                   = NULL; |  | ||||||
							
								
								
									
										150
									
								
								src/glut/dos/glutint.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										150
									
								
								src/glut/dos/glutint.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,150 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  4.0 | ||||||
|  |  * Copyright (C) 1995-1998  Brian Paul | ||||||
|  |  * | ||||||
|  |  * This library is free software; you can redistribute it and/or | ||||||
|  |  * modify it under the terms of the GNU Library General Public | ||||||
|  |  * License as published by the Free Software Foundation; either | ||||||
|  |  * version 2 of the License, or (at your option) any later version. | ||||||
|  |  * | ||||||
|  |  * This library is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  |  * Library General Public License for more details. | ||||||
|  |  * | ||||||
|  |  * You should have received a copy of the GNU Library General Public | ||||||
|  |  * License along with this library; if not, write to the Free | ||||||
|  |  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP glut driver v1.3 for Mesa | ||||||
|  |  * | ||||||
|  |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |   | ||||||
|  | #ifndef __glutint_h__ | ||||||
|  | #define __glutint_h__ | ||||||
|  |  | ||||||
|  | #include <GL/glut.h> | ||||||
|  |  | ||||||
|  | #include "GL/dmesa.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* GLUT  function types */ | ||||||
|  | typedef void (GLUTCALLBACK *GLUTdisplayCB) (void); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTreshapeCB) (int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTkeyboardCB) (unsigned char, int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTmouseCB) (int, int, int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTmotionCB) (int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTpassiveCB) (int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTentryCB) (int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTvisibilityCB) (int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTwindowStatusCB) (int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTidleCB) (void); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTtimerCB) (int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTmenuStateCB) (int);  /* DEPRECATED. */ | ||||||
|  | typedef void (GLUTCALLBACK *GLUTmenuStatusCB) (int, int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTselectCB) (int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTspecialCB) (int, int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTspaceMotionCB) (int, int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTspaceRotateCB) (int, int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTspaceButtonCB) (int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTdialsCB) (int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTbuttonBoxCB) (int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTtabletMotionCB) (int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTtabletButtonCB) (int, int, int, int); | ||||||
|  | typedef void (GLUTCALLBACK *GLUTjoystickCB) (unsigned int, int, int, int); | ||||||
|  |  | ||||||
|  | typedef struct GLUTwindow { | ||||||
|  |         int num;                         /* window id */ | ||||||
|  |  | ||||||
|  |         DMesaBuffer buffer; | ||||||
|  |  | ||||||
|  |         int show_mouse; | ||||||
|  |  | ||||||
|  |         /* GLUT settable or visible window state. */ | ||||||
|  |         int xpos; | ||||||
|  |         int ypos; | ||||||
|  |         int width;                       /* window width in pixels */ | ||||||
|  |         int height;                      /* window height in pixels */ | ||||||
|  |  | ||||||
|  |         /* Per-window callbacks. */ | ||||||
|  |         GLUTdisplayCB      display;      /* redraw */ | ||||||
|  |         GLUTreshapeCB      reshape;      /* resize (width,height) */ | ||||||
|  |         GLUTmouseCB        mouse;        /* mouse (button,state,x,y) */ | ||||||
|  |         GLUTmotionCB       motion;       /* motion (x,y) */ | ||||||
|  |         GLUTpassiveCB      passive;      /* passive motion (x,y) */ | ||||||
|  |         GLUTentryCB        entry;        /* window entry/exit (state) */ | ||||||
|  |         GLUTkeyboardCB     keyboard;     /* keyboard (ASCII,x,y) */ | ||||||
|  |         GLUTkeyboardCB     keyboardUp;   /* keyboard up (ASCII,x,y) */ | ||||||
|  |         GLUTwindowStatusCB windowStatus; /* window status */ | ||||||
|  |         GLUTvisibilityCB   visibility;   /* visibility */ | ||||||
|  |         GLUTspecialCB      special;      /* special key */ | ||||||
|  |         GLUTspecialCB      specialUp;    /* special up key */ | ||||||
|  |         GLUTbuttonBoxCB    buttonBox;    /* button box */ | ||||||
|  |         GLUTdialsCB        dials;        /* dials */ | ||||||
|  |         GLUTspaceMotionCB  spaceMotion;  /* Spaceball motion */ | ||||||
|  |         GLUTspaceRotateCB  spaceRotate;  /* Spaceball rotate */ | ||||||
|  |         GLUTspaceButtonCB  spaceButton;  /* Spaceball button */ | ||||||
|  |         GLUTtabletMotionCB tabletMotion; /* tablet motion */ | ||||||
|  |         GLUTtabletButtonCB tabletButton; /* tablet button */ | ||||||
|  |         GLUTjoystickCB     joystick;     /* joystick */ | ||||||
|  | } GLUTwindow; | ||||||
|  |  | ||||||
|  | extern GLUTidleCB g_idle_func; | ||||||
|  | extern GLUTmenuStatusCB g_menu_status_func; | ||||||
|  |  | ||||||
|  | extern GLboolean g_redisplay; | ||||||
|  |  | ||||||
|  | extern GLuint g_bpp;                  /* HW: bits per pixel */ | ||||||
|  | extern GLuint g_refresh;              /* HW: vertical refresh rate */ | ||||||
|  | extern GLuint g_screen_w, g_screen_h; /* HW: physical screen size */ | ||||||
|  | extern GLint g_driver_caps; | ||||||
|  |  | ||||||
|  | extern GLuint g_fps; | ||||||
|  |  | ||||||
|  | extern GLuint g_display_mode;         /* display bits */ | ||||||
|  | extern int g_init_x, g_init_y;        /* initial window position */ | ||||||
|  | extern GLuint g_init_w, g_init_h;     /* initial window size */ | ||||||
|  |  | ||||||
|  | extern int g_mouse;                   /* non-zero if mouse installed */ | ||||||
|  | extern int g_mouse_x, g_mouse_y;      /* mouse coords, relative to current win */ | ||||||
|  |  | ||||||
|  | extern GLUTwindow *g_curwin;          /* current window */ | ||||||
|  |  | ||||||
|  | extern char *__glutProgramName;       /* program name */ | ||||||
|  |  | ||||||
|  | extern void __glutInitMouse (void); | ||||||
|  |  | ||||||
|  | /* private routines from glut_util.c */ | ||||||
|  | extern char * __glutStrdup(const char *string); | ||||||
|  | extern void __glutWarning(char *format,...); | ||||||
|  | extern void __glutFatalError(char *format,...); | ||||||
|  | extern void __glutFatalUsage(char *format,...); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* hmmm... */ | ||||||
|  | #include "pc_hw/pc_hw.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #define MAX_WINDOWS 2 | ||||||
|  |  | ||||||
|  | #define DEFAULT_WIDTH  300 | ||||||
|  | #define DEFAULT_HEIGHT 300 | ||||||
|  | #define DEFAULT_BPP    16 | ||||||
|  |  | ||||||
|  | #define DEPTH_SIZE   16 | ||||||
|  | #define STENCIL_SIZE 8 | ||||||
|  | #define ACCUM_SIZE   16 | ||||||
|  |  | ||||||
|  | #define RESERVED_COLORS 0 | ||||||
|  |  | ||||||
|  | #endif /* __glutint_h__ */ | ||||||
| @@ -19,7 +19,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * DOS/DJGPP glut driver v1.0 for Mesa 4.0 |  * DOS/DJGPP glut driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -27,39 +27,86 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "GL/glut.h" | #include <string.h> | ||||||
| #include "internal.h" |  | ||||||
|  | #include "glutint.h" | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutInit (int *argcp, char **argv) |  | ||||||
|  | GLboolean g_redisplay = GL_FALSE; | ||||||
|  |  | ||||||
|  | GLuint g_bpp = DEFAULT_BPP; | ||||||
|  | GLuint g_refresh = 0; | ||||||
|  | GLuint g_screen_w, g_screen_h; | ||||||
|  | GLint g_driver_caps; | ||||||
|  |  | ||||||
|  | GLuint g_fps = 0; | ||||||
|  |  | ||||||
|  | GLuint g_display_mode = 0; | ||||||
|  | int g_init_x = 0, g_init_y = 0; | ||||||
|  | GLuint g_init_w = DEFAULT_WIDTH, g_init_h = DEFAULT_HEIGHT; | ||||||
|  |  | ||||||
|  | char *__glutProgramName = NULL; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutInit (int *argc, char **argv) | ||||||
| { | { | ||||||
|  |  char *str; | ||||||
|  |  const char *env; | ||||||
|  |  | ||||||
|  |  if ((env = getenv("DMESA_GLUT_BPP")) != NULL) { | ||||||
|  |     g_bpp = atoi(env); | ||||||
|  |  } | ||||||
|  |  if ((env = getenv("DMESA_GLUT_REFRESH")) != NULL) { | ||||||
|  |     g_refresh = atoi(env); | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  /* Determine program name. */ | ||||||
|  |  str = strrchr(argv[0], '/'); | ||||||
|  |  if (str == NULL) { | ||||||
|  |     str = argv[0]; | ||||||
|  |  } else { | ||||||
|  |     str++; | ||||||
|  |  } | ||||||
|  |  __glutProgramName = __glutStrdup(str); | ||||||
|  |  | ||||||
|  |  /* check if GLUT_FPS env var is set */ | ||||||
|  |  if ((env = getenv("GLUT_FPS")) != NULL) { | ||||||
|  |     if ((g_fps = atoi(env)) <= 0) { | ||||||
|  |        g_fps = 5000; /* 5000 milliseconds */ | ||||||
|  |     } | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  /* Initialize timer */ | ||||||
|  glutGet(GLUT_ELAPSED_TIME); |  glutGet(GLUT_ELAPSED_TIME); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutInitDisplayMode (unsigned int mode) | void APIENTRY glutInitDisplayMode (unsigned int mode) | ||||||
| { | { | ||||||
|  g_display_mode = mode; |  g_display_mode = mode; | ||||||
|  |  | ||||||
|  pc_install_keyb(); |  | ||||||
|  g_mouse = pc_install_mouse(); |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutInitWindowPosition (int x, int y) | void APIENTRY glutInitWindowPosition (int x, int y) | ||||||
| { | { | ||||||
|  g_xpos = x; |  g_init_x = x; | ||||||
|  g_ypos = y; |  g_init_y = y; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutInitWindowSize (int width, int height) | void APIENTRY glutInitWindowSize (int width, int height) | ||||||
| { | { | ||||||
|  g_width  = width; |  g_init_w = width; | ||||||
|  g_height = height; |  g_init_h = height; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutMainLoop (void) | void APIENTRY glutMainLoop (void) | ||||||
| { | { | ||||||
|  GLboolean idle; |  GLboolean idle; | ||||||
| @@ -67,94 +114,141 @@ void APIENTRY glutMainLoop (void) | |||||||
|  static int old_mouse_y = 0; |  static int old_mouse_y = 0; | ||||||
|  static int old_mouse_b = 0; |  static int old_mouse_b = 0; | ||||||
|  |  | ||||||
|  |  { | ||||||
|  |   GLint screen_size[2]; | ||||||
|  |   DMesaGetIntegerv(DMESA_GET_SCREEN_SIZE, screen_size); | ||||||
|  |   g_screen_w = screen_size[0]; | ||||||
|  |   g_screen_h = screen_size[1]; | ||||||
|  |   DMesaGetIntegerv(DMESA_GET_DRIVER_CAPS, &g_driver_caps); | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  pc_install_keyb(); | ||||||
|  |  __glutInitMouse(); | ||||||
|  |  | ||||||
|  glutPostRedisplay(); |  glutPostRedisplay(); | ||||||
|  if (reshape_func) reshape_func(g_width, g_height); |  if (g_curwin->reshape) { | ||||||
|  if (visibility_func) visibility_func(GLUT_VISIBLE); |     g_curwin->reshape(g_curwin->width, g_curwin->height); | ||||||
|  if (g_mouse) pc_show_mouse(); |  } | ||||||
|  |  if (g_curwin->visibility) { | ||||||
|  |     g_curwin->visibility(GLUT_VISIBLE); | ||||||
|  |  } | ||||||
|  |  | ||||||
|  while (GL_TRUE) { |  while (GL_TRUE) { | ||||||
|        idle = GL_TRUE; |        idle = GL_TRUE; | ||||||
|  |  | ||||||
|        if (g_redisplay && display_func) { |        if (g_redisplay && g_curwin->display) { | ||||||
|           idle        = GL_FALSE; |           idle        = GL_FALSE; | ||||||
|           g_redisplay = GL_FALSE; |           g_redisplay = GL_FALSE; | ||||||
|  |  | ||||||
|           if (g_mouse && !(g_display_mode & GLUT_DOUBLE)) pc_scare_mouse(); |           if (g_curwin->show_mouse && !(g_display_mode & GLUT_DOUBLE)) { | ||||||
|           display_func(); |              /* XXX scare mouse */ | ||||||
|           if (g_mouse && !(g_display_mode & GLUT_DOUBLE)) pc_unscare_mouse(); |              g_curwin->display(); | ||||||
|        } |              /* XXX unscare mouse */ | ||||||
|  |           } else { | ||||||
|        if (pc_keypressed()) { |              g_curwin->display(); | ||||||
|           int key; |  | ||||||
|  |  | ||||||
|           idle = GL_FALSE; |  | ||||||
|           key  = pc_readkey(); |  | ||||||
|  |  | ||||||
|           switch (key>>16) { |  | ||||||
|                  case KEY_F1:     if (special_func) special_func(GLUT_KEY_F1,        0, 0); break; |  | ||||||
|                  case KEY_F2:     if (special_func) special_func(GLUT_KEY_F2,        0, 0); break; |  | ||||||
|                  case KEY_F3:     if (special_func) special_func(GLUT_KEY_F3,        0, 0); break; |  | ||||||
|                  case KEY_F4:     if (special_func) special_func(GLUT_KEY_F4,        0, 0); break; |  | ||||||
|                  case KEY_F5:     if (special_func) special_func(GLUT_KEY_F5,        0, 0); break; |  | ||||||
|                  case KEY_F6:     if (special_func) special_func(GLUT_KEY_F6,        0, 0); break; |  | ||||||
|                  case KEY_F7:     if (special_func) special_func(GLUT_KEY_F7,        0, 0); break; |  | ||||||
|                  case KEY_F8:     if (special_func) special_func(GLUT_KEY_F8,        0, 0); break; |  | ||||||
|                  case KEY_F9:     if (special_func) special_func(GLUT_KEY_F9,        0, 0); break; |  | ||||||
|                  case KEY_F10:    if (special_func) special_func(GLUT_KEY_F10,       0, 0); break; |  | ||||||
|                  case KEY_F11:    if (special_func) special_func(GLUT_KEY_F11,       0, 0); break; |  | ||||||
|                  case KEY_F12:    if (special_func) special_func(GLUT_KEY_F12,       0, 0); break; |  | ||||||
|                  case KEY_LEFT:   if (special_func) special_func(GLUT_KEY_LEFT,      0, 0); break; |  | ||||||
|                  case KEY_UP:     if (special_func) special_func(GLUT_KEY_UP,        0, 0); break; |  | ||||||
|                  case KEY_RIGHT:  if (special_func) special_func(GLUT_KEY_RIGHT,     0, 0); break; |  | ||||||
|                  case KEY_DOWN:   if (special_func) special_func(GLUT_KEY_DOWN,      0, 0); break; |  | ||||||
|                  case KEY_PGUP:   if (special_func) special_func(GLUT_KEY_PAGE_UP,   0, 0); break; |  | ||||||
|                  case KEY_PGDN:   if (special_func) special_func(GLUT_KEY_PAGE_DOWN, 0, 0); break; |  | ||||||
|                  case KEY_HOME:   if (special_func) special_func(GLUT_KEY_HOME,      0, 0); break; |  | ||||||
|                  case KEY_END:    if (special_func) special_func(GLUT_KEY_END,       0, 0); break; |  | ||||||
|                  case KEY_INSERT: if (special_func) special_func(GLUT_KEY_INSERT,    0, 0); break; |  | ||||||
|                  default:         if (keyboard_func) keyboard_func(key & 0xFF, 0, 0); |  | ||||||
|           } |           } | ||||||
|        } |        } | ||||||
|  |  | ||||||
|        if (g_mouse) { |        if (g_mouse) { | ||||||
|           int mouse_x; |           int mouse_x; | ||||||
|           int mouse_y; |           int mouse_y; | ||||||
|  |           int mouse_z; | ||||||
|           int mouse_b; |           int mouse_b; | ||||||
|         |  | ||||||
|           mouse_b = pc_query_mouse(&mouse_x, &mouse_y); |           /* query mouse */ | ||||||
|            |           mouse_b = pc_query_mouse(&mouse_x, &mouse_y, &mouse_z); | ||||||
|           if (motion_func && ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y))) { |  | ||||||
|  |           /* relative to window coordinates */ | ||||||
|  |           g_mouse_x = mouse_x - g_curwin->xpos; | ||||||
|  |           g_mouse_y = mouse_y - g_curwin->ypos; | ||||||
|  |  | ||||||
|  |           /* mouse was moved? */ | ||||||
|  |           if ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y)) { | ||||||
|              idle        = GL_FALSE; |              idle        = GL_FALSE; | ||||||
|              old_mouse_x = mouse_x; |              old_mouse_x = mouse_x; | ||||||
|              old_mouse_y = mouse_y; |              old_mouse_y = mouse_y; | ||||||
|     |  | ||||||
|              motion_func(old_mouse_x, old_mouse_y); |              if (mouse_b) { | ||||||
|  |                 /* any button pressed */ | ||||||
|  |                 if (g_curwin->motion) { | ||||||
|  |                    g_curwin->motion(g_mouse_x, g_mouse_y); | ||||||
|  |                 } | ||||||
|  |              } else { | ||||||
|  |                 /* no button pressed */ | ||||||
|  |                 if (g_curwin->passive) { | ||||||
|  |                    g_curwin->passive(g_mouse_x, g_mouse_y); | ||||||
|  |                 } | ||||||
|  |              } | ||||||
|           } |           } | ||||||
|     |  | ||||||
|           if (mouse_func && (mouse_b != old_mouse_b)) { |           /* button state changed? */ | ||||||
|              int new_mouse_b = mouse_b; |           if (mouse_b != old_mouse_b) { | ||||||
|     |              GLUTmouseCB mouse_func; | ||||||
|              if ((old_mouse_b & 1) && !(new_mouse_b & 1)) |  | ||||||
|                 mouse_func(GLUT_LEFT_BUTTON, GLUT_UP,   mouse_x, mouse_y); |              if ((mouse_func = g_curwin->mouse)) { | ||||||
|              else if (!(old_mouse_b & 1) && (new_mouse_b & 1)) |                 if ((old_mouse_b & 1) && !(mouse_b & 1)) | ||||||
|                 mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, mouse_x, mouse_y); |                    mouse_func(GLUT_LEFT_BUTTON, GLUT_UP,     g_mouse_x, g_mouse_y); | ||||||
|     |                 else if (!(old_mouse_b & 1) && (mouse_b & 1)) | ||||||
|              if ((old_mouse_b & 2) && !(new_mouse_b & 2)) |                    mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN,   g_mouse_x, g_mouse_y); | ||||||
|                 mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP,   mouse_x, mouse_y); |  | ||||||
|              else if (!(old_mouse_b & 2) && (new_mouse_b & 2)) |                 if ((old_mouse_b & 2) && !(mouse_b & 2)) | ||||||
|                 mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, mouse_x, mouse_y); |                    mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP,    g_mouse_x, g_mouse_y); | ||||||
|     |                 else if (!(old_mouse_b & 2) && (mouse_b & 2)) | ||||||
|              if ((old_mouse_b & 4) && !(new_mouse_b & 4)) |                    mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN,  g_mouse_x, g_mouse_y); | ||||||
|                 mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP,   mouse_x, mouse_y); |  | ||||||
|              else if (!(old_mouse_b & 3) && (new_mouse_b & 4)) |                 if ((old_mouse_b & 4) && !(mouse_b & 4)) | ||||||
|                 mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, mouse_x, mouse_y); |                    mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP,   g_mouse_x, g_mouse_y); | ||||||
|     |                 else if (!(old_mouse_b & 3) && (mouse_b & 4)) | ||||||
|  |                    mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, g_mouse_x, g_mouse_y); | ||||||
|  |              } | ||||||
|  |  | ||||||
|              idle        = GL_FALSE; |              idle        = GL_FALSE; | ||||||
|              old_mouse_b = new_mouse_b; |              old_mouse_b = mouse_b; | ||||||
|           } |           } | ||||||
|        } |        } | ||||||
|  |  | ||||||
|        if (idle && idle_func) |        if (pc_keypressed()) { | ||||||
|           idle_func(); |           int key; | ||||||
|  |           int glut_key; | ||||||
|  |  | ||||||
|  |           idle = GL_FALSE; | ||||||
|  |           key  = pc_readkey(); | ||||||
|  |  | ||||||
|  |           switch (key>>16) { | ||||||
|  |                  case KEY_F1:     glut_key = GLUT_KEY_F1;        goto special; | ||||||
|  |                  case KEY_F2:     glut_key = GLUT_KEY_F2;        goto special; | ||||||
|  |                  case KEY_F3:     glut_key = GLUT_KEY_F3;        goto special; | ||||||
|  |                  case KEY_F4:     glut_key = GLUT_KEY_F4;        goto special; | ||||||
|  |                  case KEY_F5:     glut_key = GLUT_KEY_F5;        goto special; | ||||||
|  |                  case KEY_F6:     glut_key = GLUT_KEY_F6;        goto special; | ||||||
|  |                  case KEY_F7:     glut_key = GLUT_KEY_F7;        goto special; | ||||||
|  |                  case KEY_F8:     glut_key = GLUT_KEY_F8;        goto special; | ||||||
|  |                  case KEY_F9:     glut_key = GLUT_KEY_F9;        goto special; | ||||||
|  |                  case KEY_F10:    glut_key = GLUT_KEY_F10;       goto special; | ||||||
|  |                  case KEY_F11:    glut_key = GLUT_KEY_F11;       goto special; | ||||||
|  |                  case KEY_F12:    glut_key = GLUT_KEY_F12;       goto special; | ||||||
|  |                  case KEY_LEFT:   glut_key = GLUT_KEY_LEFT;      goto special; | ||||||
|  |                  case KEY_UP:     glut_key = GLUT_KEY_UP;        goto special; | ||||||
|  |                  case KEY_RIGHT:  glut_key = GLUT_KEY_RIGHT;     goto special; | ||||||
|  |                  case KEY_DOWN:   glut_key = GLUT_KEY_DOWN;      goto special; | ||||||
|  |                  case KEY_PGUP:   glut_key = GLUT_KEY_PAGE_UP;   goto special; | ||||||
|  |                  case KEY_PGDN:   glut_key = GLUT_KEY_PAGE_DOWN; goto special; | ||||||
|  |                  case KEY_HOME:   glut_key = GLUT_KEY_HOME;      goto special; | ||||||
|  |                  case KEY_END:    glut_key = GLUT_KEY_END;       goto special; | ||||||
|  |                  case KEY_INSERT: glut_key = GLUT_KEY_INSERT;    goto special; | ||||||
|  |                  special: | ||||||
|  |                       if (g_curwin->special) { | ||||||
|  |                          g_curwin->special(glut_key, g_mouse_x, g_mouse_y); | ||||||
|  |                       } | ||||||
|  |                       break; | ||||||
|  |                  default: | ||||||
|  |                       if (g_curwin->keyboard) { | ||||||
|  |                          g_curwin->keyboard(key & 0xFF, g_mouse_x, g_mouse_y); | ||||||
|  |                       } | ||||||
|  |           } | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        if (idle && g_idle_func) | ||||||
|  |           g_idle_func(); | ||||||
|  } |  } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,78 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Mesa 3-D graphics library |  | ||||||
|  * Version:  4.0 |  | ||||||
|  * Copyright (C) 1995-1998  Brian Paul |  | ||||||
|  * |  | ||||||
|  * This library is free software; you can redistribute it and/or |  | ||||||
|  * modify it under the terms of the GNU Library General Public |  | ||||||
|  * License as published by the Free Software Foundation; either |  | ||||||
|  * version 2 of the License, or (at your option) any later version. |  | ||||||
|  * |  | ||||||
|  * This library is distributed in the hope that it will be useful, |  | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |  | ||||||
|  * Library General Public License for more details. |  | ||||||
|  * |  | ||||||
|  * You should have received a copy of the GNU Library General Public |  | ||||||
|  * License along with this library; if not, write to the Free |  | ||||||
|  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * DOS/DJGPP glut driver v1.0 for Mesa 4.0 |  | ||||||
|  * |  | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  | ||||||
|  *  Email : dborca@yahoo.com |  | ||||||
|  *  Web   : http://www.geocities.com/dborca |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
|   |  | ||||||
| #ifndef INTERNAL_H_included |  | ||||||
| #define INTERNAL_H_included |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "GL/glut.h" |  | ||||||
| #include "pc_hw/pc_hw.h" |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #define MAX_WINDOWS    4 |  | ||||||
|  |  | ||||||
| #define DEFAULT_WIDTH  640 |  | ||||||
| #define DEFAULT_HEIGHT 480 |  | ||||||
| #define DEFAULT_BPP    16 |  | ||||||
|  |  | ||||||
| #define DEPTH_SIZE   16 |  | ||||||
| #define STENCIL_SIZE 8 |  | ||||||
| #define ACCUM_SIZE   16 |  | ||||||
|  |  | ||||||
| extern GLenum    g_display_mode; |  | ||||||
| extern GLuint    g_width; |  | ||||||
| extern GLuint    g_height; |  | ||||||
| extern GLint     g_mouse; |  | ||||||
| extern GLboolean g_redisplay; |  | ||||||
| extern GLint     g_xpos; |  | ||||||
| extern GLint     g_ypos; |  | ||||||
|  |  | ||||||
| extern void (GLUTCALLBACK *display_func) (void); |  | ||||||
| extern void (GLUTCALLBACK *reshape_func) (int width, int height); |  | ||||||
| extern void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y); |  | ||||||
| extern void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y); |  | ||||||
| extern void (GLUTCALLBACK *motion_func) (int x, int y); |  | ||||||
| extern void (GLUTCALLBACK *passive_motion_func) (int x, int y); |  | ||||||
| extern void (GLUTCALLBACK *entry_func) (int state); |  | ||||||
| extern void (GLUTCALLBACK *visibility_func) (int state); |  | ||||||
| extern void (GLUTCALLBACK *idle_func) (void); |  | ||||||
| extern void (GLUTCALLBACK *menu_state_func) (int state); |  | ||||||
| extern void (GLUTCALLBACK *special_func) (int key, int x, int y); |  | ||||||
| extern void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z); |  | ||||||
| extern void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z); |  | ||||||
| extern void (GLUTCALLBACK *spaceball_button_func) (int button, int state); |  | ||||||
| extern void (GLUTCALLBACK *button_box_func) (int button, int state); |  | ||||||
| extern void (GLUTCALLBACK *dials_func) (int dial, int value); |  | ||||||
| extern void (GLUTCALLBACK *tablet_motion_func) (int x, int y); |  | ||||||
| extern void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y); |  | ||||||
| extern void (GLUTCALLBACK *menu_status_func) (int status, int x, int y); |  | ||||||
| extern void (GLUTCALLBACK *overlay_display_func) (void); |  | ||||||
| extern void (GLUTCALLBACK *window_status_func) (int state); |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
| @@ -19,7 +19,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * DOS/DJGPP glut driver v1.0 for Mesa 4.0 |  * DOS/DJGPP glut driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -27,60 +27,90 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "GL/glut.h" | #include "glutint.h" | ||||||
|  |  | ||||||
|  |  | ||||||
| int APIENTRY glutCreateMenu (void (GLUTCALLBACK *func) (int)) |  | ||||||
|  | GLUTmenuStatusCB g_menu_status_func = NULL; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutMenuStateFunc (GLUTmenuStateCB func) | ||||||
|  | { | ||||||
|  |  g_menu_status_func = (GLUTmenuStatusCB)func; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutMenuStatusFunc (GLUTmenuStatusCB func) | ||||||
|  | { | ||||||
|  |  g_menu_status_func = func; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | int APIENTRY glutCreateMenu (GLUTselectCB func) | ||||||
| { | { | ||||||
|  return 0; |  return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutDestroyMenu (int menu) | void APIENTRY glutDestroyMenu (int menu) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int APIENTRY glutGetMenu (void) | int APIENTRY glutGetMenu (void) | ||||||
| { | { | ||||||
|  return 0; |  return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutSetMenu (int menu) | void APIENTRY glutSetMenu (int menu) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutAddMenuEntry (const char *label, int value) | void APIENTRY glutAddMenuEntry (const char *label, int value) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutAddSubMenu (const char *label, int submenu) | void APIENTRY glutAddSubMenu (const char *label, int submenu) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutChangeToMenuEntry (int item, const char *label, int value) | void APIENTRY glutChangeToMenuEntry (int item, const char *label, int value) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutChangeToSubMenu (int item, const char *label, int submenu) | void APIENTRY glutChangeToSubMenu (int item, const char *label, int submenu) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutRemoveMenuItem (int item) | void APIENTRY glutRemoveMenuItem (int item) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutAttachMenu (int button) | void APIENTRY glutAttachMenu (int button) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutDetachMenu (int button) | void APIENTRY glutDetachMenu (int button) | ||||||
| { | { | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,598 +0,0 @@ | |||||||
|  |  | ||||||
| /* Copyright (c) Mark J. Kilgard, 1994, 1997. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
| (c) Copyright 1993, Silicon Graphics, Inc. |  | ||||||
|  |  | ||||||
| ALL RIGHTS RESERVED |  | ||||||
|  |  | ||||||
| Permission to use, copy, modify, and distribute this software |  | ||||||
| for any purpose and without fee is hereby granted, provided |  | ||||||
| that the above copyright notice appear in all copies and that |  | ||||||
| both the copyright notice and this permission notice appear in |  | ||||||
| supporting documentation, and that the name of Silicon |  | ||||||
| Graphics, Inc. not be used in advertising or publicity |  | ||||||
| pertaining to distribution of the software without specific, |  | ||||||
| written prior permission. |  | ||||||
|  |  | ||||||
| THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU |  | ||||||
| "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR |  | ||||||
| OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF |  | ||||||
| MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  IN NO |  | ||||||
| EVENT SHALL SILICON GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE |  | ||||||
| ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR |  | ||||||
| CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, |  | ||||||
| INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, |  | ||||||
| SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR |  | ||||||
| NOT SILICON GRAPHICS, INC.  HAS BEEN ADVISED OF THE POSSIBILITY |  | ||||||
| OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |  | ||||||
| ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR |  | ||||||
| PERFORMANCE OF THIS SOFTWARE. |  | ||||||
|  |  | ||||||
| US Government Users Restricted Rights |  | ||||||
|  |  | ||||||
| Use, duplication, or disclosure by the Government is subject to |  | ||||||
| restrictions set forth in FAR 52.227.19(c)(2) or subparagraph |  | ||||||
| (c)(1)(ii) of the Rights in Technical Data and Computer |  | ||||||
| Software clause at DFARS 252.227-7013 and/or in similar or |  | ||||||
| successor clauses in the FAR or the DOD or NASA FAR |  | ||||||
| Supplement.  Unpublished-- rights reserved under the copyright |  | ||||||
| laws of the United States.  Contractor/manufacturer is Silicon |  | ||||||
| Graphics, Inc., 2011 N.  Shoreline Blvd., Mountain View, CA |  | ||||||
| 94039-7311. |  | ||||||
|  |  | ||||||
| OpenGL(TM) is a trademark of Silicon Graphics, Inc. |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| #include <math.h> |  | ||||||
| #include <GL/gl.h> |  | ||||||
| #include <GL/glu.h> |  | ||||||
| #include "GL/glut.h" |  | ||||||
|  |  | ||||||
| /* Some <math.h> files do not define M_PI... */ |  | ||||||
| #ifndef M_PI |  | ||||||
| #define M_PI 3.14159265358979323846 |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| static GLUquadricObj *quadObj; |  | ||||||
|  |  | ||||||
| #define QUAD_OBJ_INIT() { if(!quadObj) initQuadObj(); } |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| initQuadObj(void) |  | ||||||
| { |  | ||||||
|   quadObj = gluNewQuadric(); |  | ||||||
| /*  if (!quadObj) |  | ||||||
|     __glutFatalError("out of memory."); */ |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* CENTRY */ |  | ||||||
| void APIENTRY |  | ||||||
| glutWireSphere(GLdouble radius, GLint slices, GLint stacks) |  | ||||||
| { |  | ||||||
|   QUAD_OBJ_INIT(); |  | ||||||
|   gluQuadricDrawStyle(quadObj, GLU_LINE); |  | ||||||
|   gluQuadricNormals(quadObj, GLU_SMOOTH); |  | ||||||
|   /* If we ever changed/used the texture or orientation state |  | ||||||
|      of quadObj, we'd need to change it to the defaults here |  | ||||||
|      with gluQuadricTexture and/or gluQuadricOrientation. */ |  | ||||||
|   gluSphere(quadObj, radius, slices, stacks); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void APIENTRY |  | ||||||
| glutSolidSphere(GLdouble radius, GLint slices, GLint stacks) |  | ||||||
| { |  | ||||||
|   QUAD_OBJ_INIT(); |  | ||||||
|   gluQuadricDrawStyle(quadObj, GLU_FILL); |  | ||||||
|   gluQuadricNormals(quadObj, GLU_SMOOTH); |  | ||||||
|   /* If we ever changed/used the texture or orientation state |  | ||||||
|      of quadObj, we'd need to change it to the defaults here |  | ||||||
|      with gluQuadricTexture and/or gluQuadricOrientation. */ |  | ||||||
|   gluSphere(quadObj, radius, slices, stacks); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void APIENTRY |  | ||||||
| glutWireCone(GLdouble base, GLdouble height, |  | ||||||
|   GLint slices, GLint stacks) |  | ||||||
| { |  | ||||||
|   QUAD_OBJ_INIT(); |  | ||||||
|   gluQuadricDrawStyle(quadObj, GLU_LINE); |  | ||||||
|   gluQuadricNormals(quadObj, GLU_SMOOTH); |  | ||||||
|   /* If we ever changed/used the texture or orientation state |  | ||||||
|      of quadObj, we'd need to change it to the defaults here |  | ||||||
|      with gluQuadricTexture and/or gluQuadricOrientation. */ |  | ||||||
|   gluCylinder(quadObj, base, 0.0, height, slices, stacks); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void APIENTRY |  | ||||||
| glutSolidCone(GLdouble base, GLdouble height, |  | ||||||
|   GLint slices, GLint stacks) |  | ||||||
| { |  | ||||||
|   QUAD_OBJ_INIT(); |  | ||||||
|   gluQuadricDrawStyle(quadObj, GLU_FILL); |  | ||||||
|   gluQuadricNormals(quadObj, GLU_SMOOTH); |  | ||||||
|   /* If we ever changed/used the texture or orientation state |  | ||||||
|      of quadObj, we'd need to change it to the defaults here |  | ||||||
|      with gluQuadricTexture and/or gluQuadricOrientation. */ |  | ||||||
|   gluCylinder(quadObj, base, 0.0, height, slices, stacks); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* ENDCENTRY */ |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| drawBox(GLfloat size, GLenum type) |  | ||||||
| { |  | ||||||
|   static GLfloat n[6][3] = |  | ||||||
|   { |  | ||||||
|     {-1.0, 0.0, 0.0}, |  | ||||||
|     {0.0, 1.0, 0.0}, |  | ||||||
|     {1.0, 0.0, 0.0}, |  | ||||||
|     {0.0, -1.0, 0.0}, |  | ||||||
|     {0.0, 0.0, 1.0}, |  | ||||||
|     {0.0, 0.0, -1.0} |  | ||||||
|   }; |  | ||||||
|   static GLint faces[6][4] = |  | ||||||
|   { |  | ||||||
|     {0, 1, 2, 3}, |  | ||||||
|     {3, 2, 6, 7}, |  | ||||||
|     {7, 6, 5, 4}, |  | ||||||
|     {4, 5, 1, 0}, |  | ||||||
|     {5, 6, 2, 1}, |  | ||||||
|     {7, 4, 0, 3} |  | ||||||
|   }; |  | ||||||
|   GLfloat v[8][3]; |  | ||||||
|   GLint i; |  | ||||||
|  |  | ||||||
|   v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2; |  | ||||||
|   v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2; |  | ||||||
|   v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size / 2; |  | ||||||
|   v[2][1] = v[3][1] = v[6][1] = v[7][1] = size / 2; |  | ||||||
|   v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2; |  | ||||||
|   v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2; |  | ||||||
|  |  | ||||||
|   for (i = 5; i >= 0; i--) { |  | ||||||
|     glBegin(type); |  | ||||||
|     glNormal3fv(&n[i][0]); |  | ||||||
|     glVertex3fv(&v[faces[i][0]][0]); |  | ||||||
|     glVertex3fv(&v[faces[i][1]][0]); |  | ||||||
|     glVertex3fv(&v[faces[i][2]][0]); |  | ||||||
|     glVertex3fv(&v[faces[i][3]][0]); |  | ||||||
|     glEnd(); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* CENTRY */ |  | ||||||
| void APIENTRY |  | ||||||
| glutWireCube(GLdouble size) |  | ||||||
| { |  | ||||||
|   drawBox(size, GL_LINE_LOOP); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void APIENTRY |  | ||||||
| glutSolidCube(GLdouble size) |  | ||||||
| { |  | ||||||
|   drawBox(size, GL_QUADS); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* ENDCENTRY */ |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings) |  | ||||||
| { |  | ||||||
|   int i, j; |  | ||||||
|   GLfloat theta, phi, theta1; |  | ||||||
|   GLfloat cosTheta, sinTheta; |  | ||||||
|   GLfloat cosTheta1, sinTheta1; |  | ||||||
|   GLfloat ringDelta, sideDelta; |  | ||||||
|  |  | ||||||
|   ringDelta = 2.0 * M_PI / rings; |  | ||||||
|   sideDelta = 2.0 * M_PI / nsides; |  | ||||||
|  |  | ||||||
|   theta = 0.0; |  | ||||||
|   cosTheta = 1.0; |  | ||||||
|   sinTheta = 0.0; |  | ||||||
|   for (i = rings - 1; i >= 0; i--) { |  | ||||||
|     theta1 = theta + ringDelta; |  | ||||||
|     cosTheta1 = cos(theta1); |  | ||||||
|     sinTheta1 = sin(theta1); |  | ||||||
|     glBegin(GL_QUAD_STRIP); |  | ||||||
|     phi = 0.0; |  | ||||||
|     for (j = nsides; j >= 0; j--) { |  | ||||||
|       GLfloat cosPhi, sinPhi, dist; |  | ||||||
|  |  | ||||||
|       phi += sideDelta; |  | ||||||
|       cosPhi = cos(phi); |  | ||||||
|       sinPhi = sin(phi); |  | ||||||
|       dist = R + r * cosPhi; |  | ||||||
|  |  | ||||||
|       glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); |  | ||||||
|       glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); |  | ||||||
|       glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); |  | ||||||
|       glVertex3f(cosTheta * dist, -sinTheta * dist,  r * sinPhi); |  | ||||||
|     } |  | ||||||
|     glEnd(); |  | ||||||
|     theta = theta1; |  | ||||||
|     cosTheta = cosTheta1; |  | ||||||
|     sinTheta = sinTheta1; |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* CENTRY */ |  | ||||||
| void APIENTRY |  | ||||||
| glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, |  | ||||||
|   GLint nsides, GLint rings) |  | ||||||
| { |  | ||||||
|   glPushAttrib(GL_POLYGON_BIT); |  | ||||||
|   glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); |  | ||||||
|   doughnut(innerRadius, outerRadius, nsides, rings); |  | ||||||
|   glPopAttrib(); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void APIENTRY |  | ||||||
| glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, |  | ||||||
|   GLint nsides, GLint rings) |  | ||||||
| { |  | ||||||
|   doughnut(innerRadius, outerRadius, nsides, rings); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* ENDCENTRY */ |  | ||||||
|  |  | ||||||
| static GLfloat dodec[20][3]; |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| initDodecahedron(void) |  | ||||||
| { |  | ||||||
|   GLfloat alpha, beta; |  | ||||||
|  |  | ||||||
|   alpha = sqrt(2.0 / (3.0 + sqrt(5.0))); |  | ||||||
|   beta = 1.0 + sqrt(6.0 / (3.0 + sqrt(5.0)) - |  | ||||||
|     2.0 + 2.0 * sqrt(2.0 / (3.0 + sqrt(5.0)))); |  | ||||||
|   /* *INDENT-OFF* */ |  | ||||||
|   dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta; |  | ||||||
|   dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta; |  | ||||||
|   dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1; |  | ||||||
|   dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1; |  | ||||||
|   dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1; |  | ||||||
|   dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1; |  | ||||||
|   dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1; |  | ||||||
|   dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1; |  | ||||||
|   dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1; |  | ||||||
|   dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1; |  | ||||||
|   dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0; |  | ||||||
|   dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0; |  | ||||||
|   dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0; |  | ||||||
|   dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0; |  | ||||||
|   dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta; |  | ||||||
|   dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta; |  | ||||||
|   dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha; |  | ||||||
|   dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha; |  | ||||||
|   dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha; |  | ||||||
|   dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha; |  | ||||||
|   /* *INDENT-ON* */ |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #define DIFF3(_a,_b,_c) { \ |  | ||||||
|     (_c)[0] = (_a)[0] - (_b)[0]; \ |  | ||||||
|     (_c)[1] = (_a)[1] - (_b)[1]; \ |  | ||||||
|     (_c)[2] = (_a)[2] - (_b)[2]; \ |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| crossprod(GLfloat v1[3], GLfloat v2[3], GLfloat prod[3]) |  | ||||||
| { |  | ||||||
|   GLfloat p[3];         /* in case prod == v1 or v2 */ |  | ||||||
|  |  | ||||||
|   p[0] = v1[1] * v2[2] - v2[1] * v1[2]; |  | ||||||
|   p[1] = v1[2] * v2[0] - v2[2] * v1[0]; |  | ||||||
|   p[2] = v1[0] * v2[1] - v2[0] * v1[1]; |  | ||||||
|   prod[0] = p[0]; |  | ||||||
|   prod[1] = p[1]; |  | ||||||
|   prod[2] = p[2]; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| normalize(GLfloat v[3]) |  | ||||||
| { |  | ||||||
|   GLfloat d; |  | ||||||
|  |  | ||||||
|   d = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); |  | ||||||
|   if (d == 0.0) { |  | ||||||
| //    __glutWarning("normalize: zero length vector"); |  | ||||||
|     v[0] = d = 1.0; |  | ||||||
|   } |  | ||||||
|   d = 1 / d; |  | ||||||
|   v[0] *= d; |  | ||||||
|   v[1] *= d; |  | ||||||
|   v[2] *= d; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| pentagon(int a, int b, int c, int d, int e, GLenum shadeType) |  | ||||||
| { |  | ||||||
|   GLfloat n0[3], d1[3], d2[3]; |  | ||||||
|  |  | ||||||
|   DIFF3(dodec[a], dodec[b], d1); |  | ||||||
|   DIFF3(dodec[b], dodec[c], d2); |  | ||||||
|   crossprod(d1, d2, n0); |  | ||||||
|   normalize(n0); |  | ||||||
|  |  | ||||||
|   glBegin(shadeType); |  | ||||||
|   glNormal3fv(n0); |  | ||||||
|   glVertex3fv(&dodec[a][0]); |  | ||||||
|   glVertex3fv(&dodec[b][0]); |  | ||||||
|   glVertex3fv(&dodec[c][0]); |  | ||||||
|   glVertex3fv(&dodec[d][0]); |  | ||||||
|   glVertex3fv(&dodec[e][0]); |  | ||||||
|   glEnd(); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| dodecahedron(GLenum type) |  | ||||||
| { |  | ||||||
|   static int inited = 0; |  | ||||||
|  |  | ||||||
|   if (inited == 0) { |  | ||||||
|     inited = 1; |  | ||||||
|     initDodecahedron(); |  | ||||||
|   } |  | ||||||
|   pentagon(0, 1, 9, 16, 5, type); |  | ||||||
|   pentagon(1, 0, 3, 18, 7, type); |  | ||||||
|   pentagon(1, 7, 11, 10, 9, type); |  | ||||||
|   pentagon(11, 7, 18, 19, 6, type); |  | ||||||
|   pentagon(8, 17, 16, 9, 10, type); |  | ||||||
|   pentagon(2, 14, 15, 6, 19, type); |  | ||||||
|   pentagon(2, 13, 12, 4, 14, type); |  | ||||||
|   pentagon(2, 19, 18, 3, 13, type); |  | ||||||
|   pentagon(3, 0, 5, 12, 13, type); |  | ||||||
|   pentagon(6, 15, 8, 10, 11, type); |  | ||||||
|   pentagon(4, 17, 8, 15, 14, type); |  | ||||||
|   pentagon(4, 12, 5, 16, 17, type); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* CENTRY */ |  | ||||||
| void APIENTRY |  | ||||||
| glutWireDodecahedron(void) |  | ||||||
| { |  | ||||||
|   dodecahedron(GL_LINE_LOOP); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void APIENTRY |  | ||||||
| glutSolidDodecahedron(void) |  | ||||||
| { |  | ||||||
|   dodecahedron(GL_TRIANGLE_FAN); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* ENDCENTRY */ |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| recorditem(GLfloat * n1, GLfloat * n2, GLfloat * n3, |  | ||||||
|   GLenum shadeType) |  | ||||||
| { |  | ||||||
|   GLfloat q0[3], q1[3]; |  | ||||||
|  |  | ||||||
|   DIFF3(n1, n2, q0); |  | ||||||
|   DIFF3(n2, n3, q1); |  | ||||||
|   crossprod(q0, q1, q1); |  | ||||||
|   normalize(q1); |  | ||||||
|  |  | ||||||
|   glBegin(shadeType); |  | ||||||
|   glNormal3fv(q1); |  | ||||||
|   glVertex3fv(n1); |  | ||||||
|   glVertex3fv(n2); |  | ||||||
|   glVertex3fv(n3); |  | ||||||
|   glEnd(); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| subdivide(GLfloat * v0, GLfloat * v1, GLfloat * v2, |  | ||||||
|   GLenum shadeType) |  | ||||||
| { |  | ||||||
|   int depth; |  | ||||||
|   GLfloat w0[3], w1[3], w2[3]; |  | ||||||
|   GLfloat l; |  | ||||||
|   int i, j, k, n; |  | ||||||
|  |  | ||||||
|   depth = 1; |  | ||||||
|   for (i = 0; i < depth; i++) { |  | ||||||
|     for (j = 0; i + j < depth; j++) { |  | ||||||
|       k = depth - i - j; |  | ||||||
|       for (n = 0; n < 3; n++) { |  | ||||||
|         w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth; |  | ||||||
|         w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n]) |  | ||||||
|           / depth; |  | ||||||
|         w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n]) |  | ||||||
|           / depth; |  | ||||||
|       } |  | ||||||
|       l = sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]); |  | ||||||
|       w0[0] /= l; |  | ||||||
|       w0[1] /= l; |  | ||||||
|       w0[2] /= l; |  | ||||||
|       l = sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]); |  | ||||||
|       w1[0] /= l; |  | ||||||
|       w1[1] /= l; |  | ||||||
|       w1[2] /= l; |  | ||||||
|       l = sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]); |  | ||||||
|       w2[0] /= l; |  | ||||||
|       w2[1] /= l; |  | ||||||
|       w2[2] /= l; |  | ||||||
|       recorditem(w1, w0, w2, shadeType); |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| drawtriangle(int i, GLfloat data[][3], int ndx[][3], |  | ||||||
|   GLenum shadeType) |  | ||||||
| { |  | ||||||
|   GLfloat *x0, *x1, *x2; |  | ||||||
|  |  | ||||||
|   x0 = data[ndx[i][0]]; |  | ||||||
|   x1 = data[ndx[i][1]]; |  | ||||||
|   x2 = data[ndx[i][2]]; |  | ||||||
|   subdivide(x0, x1, x2, shadeType); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* octahedron data: The octahedron produced is centered at the |  | ||||||
|    origin and has radius 1.0 */ |  | ||||||
| static GLfloat odata[6][3] = |  | ||||||
| { |  | ||||||
|   {1.0, 0.0, 0.0}, |  | ||||||
|   {-1.0, 0.0, 0.0}, |  | ||||||
|   {0.0, 1.0, 0.0}, |  | ||||||
|   {0.0, -1.0, 0.0}, |  | ||||||
|   {0.0, 0.0, 1.0}, |  | ||||||
|   {0.0, 0.0, -1.0} |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static int ondex[8][3] = |  | ||||||
| { |  | ||||||
|   {0, 4, 2}, |  | ||||||
|   {1, 2, 4}, |  | ||||||
|   {0, 3, 4}, |  | ||||||
|   {1, 4, 3}, |  | ||||||
|   {0, 2, 5}, |  | ||||||
|   {1, 5, 2}, |  | ||||||
|   {0, 5, 3}, |  | ||||||
|   {1, 3, 5} |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| octahedron(GLenum shadeType) |  | ||||||
| { |  | ||||||
|   int i; |  | ||||||
|  |  | ||||||
|   for (i = 7; i >= 0; i--) { |  | ||||||
|     drawtriangle(i, odata, ondex, shadeType); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* CENTRY */ |  | ||||||
| void APIENTRY |  | ||||||
| glutWireOctahedron(void) |  | ||||||
| { |  | ||||||
|   octahedron(GL_LINE_LOOP); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void APIENTRY |  | ||||||
| glutSolidOctahedron(void) |  | ||||||
| { |  | ||||||
|   octahedron(GL_TRIANGLES); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* ENDCENTRY */ |  | ||||||
|  |  | ||||||
| /* icosahedron data: These numbers are rigged to make an |  | ||||||
|    icosahedron of radius 1.0 */ |  | ||||||
|  |  | ||||||
| #define X .525731112119133606 |  | ||||||
| #define Z .850650808352039932 |  | ||||||
|  |  | ||||||
| static GLfloat idata[12][3] = |  | ||||||
| { |  | ||||||
|   {-X, 0, Z}, |  | ||||||
|   {X, 0, Z}, |  | ||||||
|   {-X, 0, -Z}, |  | ||||||
|   {X, 0, -Z}, |  | ||||||
|   {0, Z, X}, |  | ||||||
|   {0, Z, -X}, |  | ||||||
|   {0, -Z, X}, |  | ||||||
|   {0, -Z, -X}, |  | ||||||
|   {Z, X, 0}, |  | ||||||
|   {-Z, X, 0}, |  | ||||||
|   {Z, -X, 0}, |  | ||||||
|   {-Z, -X, 0} |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static int index[20][3] = |  | ||||||
| { |  | ||||||
|   {0, 4, 1}, |  | ||||||
|   {0, 9, 4}, |  | ||||||
|   {9, 5, 4}, |  | ||||||
|   {4, 5, 8}, |  | ||||||
|   {4, 8, 1}, |  | ||||||
|   {8, 10, 1}, |  | ||||||
|   {8, 3, 10}, |  | ||||||
|   {5, 3, 8}, |  | ||||||
|   {5, 2, 3}, |  | ||||||
|   {2, 7, 3}, |  | ||||||
|   {7, 10, 3}, |  | ||||||
|   {7, 6, 10}, |  | ||||||
|   {7, 11, 6}, |  | ||||||
|   {11, 0, 6}, |  | ||||||
|   {0, 1, 6}, |  | ||||||
|   {6, 1, 10}, |  | ||||||
|   {9, 0, 11}, |  | ||||||
|   {9, 11, 2}, |  | ||||||
|   {9, 2, 5}, |  | ||||||
|   {7, 2, 11}, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| icosahedron(GLenum shadeType) |  | ||||||
| { |  | ||||||
|   int i; |  | ||||||
|  |  | ||||||
|   for (i = 19; i >= 0; i--) { |  | ||||||
|     drawtriangle(i, idata, index, shadeType); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* CENTRY */ |  | ||||||
| void APIENTRY |  | ||||||
| glutWireIcosahedron(void) |  | ||||||
| { |  | ||||||
|   icosahedron(GL_LINE_LOOP); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void APIENTRY |  | ||||||
| glutSolidIcosahedron(void) |  | ||||||
| { |  | ||||||
|   icosahedron(GL_TRIANGLES); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* ENDCENTRY */ |  | ||||||
|  |  | ||||||
| /* tetrahedron data: */ |  | ||||||
|  |  | ||||||
| #define T       1.73205080756887729 |  | ||||||
|  |  | ||||||
| static GLfloat tdata[4][3] = |  | ||||||
| { |  | ||||||
|   {T, T, T}, |  | ||||||
|   {T, -T, -T}, |  | ||||||
|   {-T, T, -T}, |  | ||||||
|   {-T, -T, T} |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static int tndex[4][3] = |  | ||||||
| { |  | ||||||
|   {0, 1, 3}, |  | ||||||
|   {2, 1, 0}, |  | ||||||
|   {3, 2, 0}, |  | ||||||
|   {1, 2, 3} |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| tetrahedron(GLenum shadeType) |  | ||||||
| { |  | ||||||
|   int i; |  | ||||||
|  |  | ||||||
|   for (i = 3; i >= 0; i--) |  | ||||||
|     drawtriangle(i, tdata, tndex, shadeType); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* CENTRY */ |  | ||||||
| void APIENTRY |  | ||||||
| glutWireTetrahedron(void) |  | ||||||
| { |  | ||||||
|   tetrahedron(GL_LINE_LOOP); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void APIENTRY |  | ||||||
| glutSolidTetrahedron(void) |  | ||||||
| { |  | ||||||
|   tetrahedron(GL_TRIANGLES); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* ENDCENTRY */ |  | ||||||
							
								
								
									
										60
									
								
								src/glut/dos/mouse.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								src/glut/dos/mouse.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  3.4 | ||||||
|  |  * Copyright (C) 1995-1998  Brian Paul | ||||||
|  |  * | ||||||
|  |  * This library is free software; you can redistribute it and/or | ||||||
|  |  * modify it under the terms of the GNU Library General Public | ||||||
|  |  * License as published by the Free Software Foundation; either | ||||||
|  |  * version 2 of the License, or (at your option) any later version. | ||||||
|  |  * | ||||||
|  |  * This library is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||||
|  |  * Library General Public License for more details. | ||||||
|  |  * | ||||||
|  |  * You should have received a copy of the GNU Library General Public | ||||||
|  |  * License along with this library; if not, write to the Free | ||||||
|  |  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP glut driver v1.3 for Mesa | ||||||
|  |  * | ||||||
|  |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #include "glutint.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | int g_mouse; | ||||||
|  | int g_mouse_x = 0, g_mouse_y = 0; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void __glutInitMouse (void) | ||||||
|  | { | ||||||
|  |  if ((g_mouse = pc_install_mouse())) { | ||||||
|  |     pc_mouse_area(g_curwin->xpos, g_curwin->ypos, g_curwin->xpos + g_curwin->width - 1, g_curwin->ypos + g_curwin->height - 1); | ||||||
|  |  | ||||||
|  |     g_curwin->show_mouse = (g_curwin->mouse || g_curwin->motion || g_curwin->passive); | ||||||
|  |  } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutSetCursor (int cursor) | ||||||
|  | { | ||||||
|  |  /* XXX completely futile until full mouse support (maybe never) */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutWarpPointer (int x, int y) | ||||||
|  | { | ||||||
|  |  pc_warp_mouse(x, y); | ||||||
|  | } | ||||||
| @@ -19,7 +19,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * DOS/DJGPP glut driver v1.0 for Mesa 4.0 |  * DOS/DJGPP glut driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -27,7 +27,33 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "GL/glut.h" | #include "glutint.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | int APIENTRY glutLayerGet (GLenum info) | ||||||
|  | { | ||||||
|  |  switch (info) { | ||||||
|  |         case GLUT_OVERLAY_POSSIBLE: | ||||||
|  |         case GLUT_HAS_OVERLAY: | ||||||
|  |              return GL_FALSE; | ||||||
|  |         case GLUT_LAYER_IN_USE: | ||||||
|  |              return GLUT_NORMAL; | ||||||
|  |         case GLUT_NORMAL_DAMAGED: | ||||||
|  |              return GL_FALSE; | ||||||
|  |         case GLUT_OVERLAY_DAMAGED: | ||||||
|  |         case GLUT_TRANSPARENT_INDEX: | ||||||
|  |         default: | ||||||
|  |              return -1; | ||||||
|  |  } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutOverlayDisplayFunc (GLUTdisplayCB func) | ||||||
|  | { | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutEstablishOverlay (void) | void APIENTRY glutEstablishOverlay (void) | ||||||
| @@ -35,26 +61,31 @@ void APIENTRY glutEstablishOverlay (void) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutRemoveOverlay (void) | void APIENTRY glutRemoveOverlay (void) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutUseLayer (GLenum layer) | void APIENTRY glutUseLayer (GLenum layer) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutPostOverlayRedisplay (void) | void APIENTRY glutPostOverlayRedisplay (void) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutShowOverlay (void) | void APIENTRY glutShowOverlay (void) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutHideOverlay (void) | void APIENTRY glutHideOverlay (void) | ||||||
| { | { | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * DOS/DJGPP glut driver v1.0 for Mesa 4.0 |  * DOS/DJGPP glut driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -27,16 +27,19 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "GL/glut.h" | #include "glutint.h" | ||||||
| #include "internal.h" |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #define FREQUENCY 100 | #define FREQUENCY 100 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static int timer_installed; | static int timer_installed; | ||||||
| static volatile int ticks; | static volatile int ticks; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static void ticks_timer (void *p) | static void ticks_timer (void *p) | ||||||
| { | { | ||||||
|  (void)p; |  (void)p; | ||||||
| @@ -48,23 +51,92 @@ static void ticks_timer (void *p) | |||||||
| int APIENTRY glutGet (GLenum type) | int APIENTRY glutGet (GLenum type) | ||||||
| { | { | ||||||
|  switch (type) { |  switch (type) { | ||||||
|  |         case GLUT_WINDOW_X: | ||||||
|  |              return g_curwin->xpos; | ||||||
|  |         case GLUT_WINDOW_Y: | ||||||
|  |              return g_curwin->ypos; | ||||||
|  |         case GLUT_WINDOW_WIDTH: | ||||||
|  |              return g_curwin->width; | ||||||
|  |         case GLUT_WINDOW_HEIGHT: | ||||||
|  |              return g_curwin->height; | ||||||
|  |         case GLUT_WINDOW_STENCIL_SIZE: | ||||||
|  |              return STENCIL_SIZE; | ||||||
|  |         case GLUT_WINDOW_DEPTH_SIZE: | ||||||
|  |              return DEPTH_SIZE; | ||||||
|         case GLUT_WINDOW_RGBA: |         case GLUT_WINDOW_RGBA: | ||||||
|              return 1; |              return !(g_display_mode & GLUT_INDEX); | ||||||
|  |         case GLUT_WINDOW_COLORMAP_SIZE: | ||||||
|  |              return (g_display_mode & GLUT_INDEX) ? (256 - RESERVED_COLORS) : 0; | ||||||
|  |         case GLUT_SCREEN_WIDTH: | ||||||
|  |              return g_screen_w; | ||||||
|  |         case GLUT_SCREEN_HEIGHT: | ||||||
|  |              return g_screen_h; | ||||||
|  |         case GLUT_INIT_WINDOW_X: | ||||||
|  |              return g_init_x; | ||||||
|  |         case GLUT_INIT_WINDOW_Y: | ||||||
|  |              return g_init_y; | ||||||
|  |         case GLUT_INIT_WINDOW_WIDTH: | ||||||
|  |              return g_init_w; | ||||||
|  |         case GLUT_INIT_WINDOW_HEIGHT: | ||||||
|  |              return g_init_h; | ||||||
|  |         case GLUT_INIT_DISPLAY_MODE: | ||||||
|  |              return g_display_mode; | ||||||
|         case GLUT_ELAPSED_TIME: |         case GLUT_ELAPSED_TIME: | ||||||
|              if (!timer_installed) { |              if (!timer_installed) { | ||||||
|                 timer_installed = !timer_installed; |                 timer_installed = GL_TRUE; | ||||||
|                 LOCKDATA(ticks); |                 LOCKDATA(ticks); | ||||||
|                 LOCKFUNC(ticks_timer); |                 LOCKFUNC(ticks_timer); | ||||||
|                 pc_install_int(ticks_timer, NULL, FREQUENCY); |                 pc_install_int(ticks_timer, NULL, FREQUENCY); | ||||||
|              } |              } | ||||||
|              return ticks*1000/FREQUENCY; |              return ticks*1000/FREQUENCY; | ||||||
|         default: |         default: | ||||||
|              return 0; |              return -1; | ||||||
|  } |  } | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int APIENTRY glutDeviceGet (GLenum type) | int APIENTRY glutDeviceGet (GLenum type) | ||||||
| { | { | ||||||
|  return 0; |  switch (type) { | ||||||
|  |         case GLUT_HAS_KEYBOARD: | ||||||
|  |              return GL_TRUE; | ||||||
|  |         case GLUT_HAS_MOUSE: | ||||||
|  |              return (g_mouse != 0); | ||||||
|  |         case GLUT_NUM_MOUSE_BUTTONS: | ||||||
|  |              return g_mouse; | ||||||
|  |         case GLUT_HAS_SPACEBALL: | ||||||
|  |         case GLUT_HAS_DIAL_AND_BUTTON_BOX: | ||||||
|  |         case GLUT_HAS_TABLET: | ||||||
|  |              return GL_FALSE; | ||||||
|  |         case GLUT_NUM_SPACEBALL_BUTTONS: | ||||||
|  |         case GLUT_NUM_BUTTON_BOX_BUTTONS: | ||||||
|  |         case GLUT_NUM_DIALS: | ||||||
|  |         case GLUT_NUM_TABLET_BUTTONS: | ||||||
|  |              return 0; | ||||||
|  |         default: | ||||||
|  |              return -1; | ||||||
|  |  } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | int APIENTRY glutGetModifiers (void) | ||||||
|  | { | ||||||
|  |  int mod = 0; | ||||||
|  |  int shifts = pc_keyshifts(); | ||||||
|  |  | ||||||
|  |  if (shifts & (KB_SHIFT_FLAG | KB_CAPSLOCK_FLAG)) { | ||||||
|  |     mod |= GLUT_ACTIVE_SHIFT; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  if (shifts & KB_ALT_FLAG) { | ||||||
|  |     mod |= GLUT_ACTIVE_ALT; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  if (shifts & KB_CTRL_FLAG) { | ||||||
|  |     mod |= GLUT_ACTIVE_CTRL; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  return mod; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,212 +0,0 @@ | |||||||
|  |  | ||||||
| /* Copyright (c) Mark J. Kilgard, 1994. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
| (c) Copyright 1993, Silicon Graphics, Inc. |  | ||||||
|  |  | ||||||
| ALL RIGHTS RESERVED |  | ||||||
|  |  | ||||||
| Permission to use, copy, modify, and distribute this software |  | ||||||
| for any purpose and without fee is hereby granted, provided |  | ||||||
| that the above copyright notice appear in all copies and that |  | ||||||
| both the copyright notice and this permission notice appear in |  | ||||||
| supporting documentation, and that the name of Silicon |  | ||||||
| Graphics, Inc. not be used in advertising or publicity |  | ||||||
| pertaining to distribution of the software without specific, |  | ||||||
| written prior permission. |  | ||||||
|  |  | ||||||
| THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU |  | ||||||
| "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR |  | ||||||
| OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF |  | ||||||
| MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  IN NO |  | ||||||
| EVENT SHALL SILICON GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE |  | ||||||
| ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR |  | ||||||
| CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, |  | ||||||
| INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, |  | ||||||
| SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR |  | ||||||
| NOT SILICON GRAPHICS, INC.  HAS BEEN ADVISED OF THE POSSIBILITY |  | ||||||
| OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |  | ||||||
| ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR |  | ||||||
| PERFORMANCE OF THIS SOFTWARE. |  | ||||||
|  |  | ||||||
| US Government Users Restricted Rights |  | ||||||
|  |  | ||||||
| Use, duplication, or disclosure by the Government is subject to |  | ||||||
| restrictions set forth in FAR 52.227.19(c)(2) or subparagraph |  | ||||||
| (c)(1)(ii) of the Rights in Technical Data and Computer |  | ||||||
| Software clause at DFARS 252.227-7013 and/or in similar or |  | ||||||
| successor clauses in the FAR or the DOD or NASA FAR |  | ||||||
| Supplement.  Unpublished-- rights reserved under the copyright |  | ||||||
| laws of the United States.  Contractor/manufacturer is Silicon |  | ||||||
| Graphics, Inc., 2011 N.  Shoreline Blvd., Mountain View, CA |  | ||||||
| 94039-7311. |  | ||||||
|  |  | ||||||
| OpenGL(TM) is a trademark of Silicon Graphics, Inc. |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| #include <GL/gl.h> |  | ||||||
| #include <GL/glu.h> |  | ||||||
| #include "GL/glut.h" |  | ||||||
|  |  | ||||||
| /* Rim, body, lid, and bottom data must be reflected in x and |  | ||||||
|    y; handle and spout data across the y axis only.  */ |  | ||||||
|  |  | ||||||
| static int patchdata[][16] = |  | ||||||
| { |  | ||||||
|     /* rim */ |  | ||||||
|   {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, |  | ||||||
|     12, 13, 14, 15}, |  | ||||||
|     /* body */ |  | ||||||
|   {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, |  | ||||||
|     24, 25, 26, 27}, |  | ||||||
|   {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, |  | ||||||
|     37, 38, 39, 40}, |  | ||||||
|     /* lid */ |  | ||||||
|   {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, |  | ||||||
|     101, 0, 1, 2, 3,}, |  | ||||||
|   {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, |  | ||||||
|     113, 114, 115, 116, 117}, |  | ||||||
|     /* bottom */ |  | ||||||
|   {118, 118, 118, 118, 124, 122, 119, 121, 123, 126, |  | ||||||
|     125, 120, 40, 39, 38, 37}, |  | ||||||
|     /* handle */ |  | ||||||
|   {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |  | ||||||
|     53, 54, 55, 56}, |  | ||||||
|   {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |  | ||||||
|     28, 65, 66, 67}, |  | ||||||
|     /* spout */ |  | ||||||
|   {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |  | ||||||
|     80, 81, 82, 83}, |  | ||||||
|   {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |  | ||||||
|     92, 93, 94, 95} |  | ||||||
| }; |  | ||||||
| /* *INDENT-OFF* */ |  | ||||||
|  |  | ||||||
| static float cpdata[][3] = |  | ||||||
| { |  | ||||||
|     {0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0, |  | ||||||
|     -0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125}, |  | ||||||
|     {0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125}, {1.4375, |  | ||||||
|     0, 2.53125}, {1.4375, -0.805, 2.53125}, {0.805, -1.4375, |  | ||||||
|     2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4}, {1.5, -0.84, |  | ||||||
|     2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875}, |  | ||||||
|     {1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75, |  | ||||||
|     1.875}, {2, 0, 1.35}, {2, -1.12, 1.35}, {1.12, -2, 1.35}, |  | ||||||
|     {0, -2, 1.35}, {2, 0, 0.9}, {2, -1.12, 0.9}, {1.12, -2, |  | ||||||
|     0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45}, {2, -1.12, |  | ||||||
|     0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225}, |  | ||||||
|     {1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225}, |  | ||||||
|     {1.5, 0, 0.15}, {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0, |  | ||||||
|     -1.5, 0.15}, {-1.6, 0, 2.025}, {-1.6, -0.3, 2.025}, {-1.5, |  | ||||||
|     -0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025}, {-2.3, -0.3, |  | ||||||
|     2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0, |  | ||||||
|     2.025}, {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0, |  | ||||||
|     2.25}, {-2.7, 0, 1.8}, {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8}, |  | ||||||
|     {-3, 0, 1.8}, {-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3, |  | ||||||
|     -0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3, |  | ||||||
|     1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2, |  | ||||||
|     -0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0, |  | ||||||
|     1.425}, {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0, |  | ||||||
|     0.6}, {2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66, |  | ||||||
|     0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1}, |  | ||||||
|     {2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4}, {2.7, |  | ||||||
|     -0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0, |  | ||||||
|     2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375}, |  | ||||||
|     {3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475}, |  | ||||||
|     {3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4}, |  | ||||||
|     {2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4}, {0, 0, |  | ||||||
|     3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15}, {0.45, -0.8, |  | ||||||
|     3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4}, {1.4, |  | ||||||
|     -0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0, |  | ||||||
|     2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4, |  | ||||||
|     2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55}, {0.728, -1.3, |  | ||||||
|     2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4}, {1.3, -0.728, 2.4}, |  | ||||||
|     {0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0}, {1.425, |  | ||||||
|     -0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425, |  | ||||||
|     0}, {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075}, |  | ||||||
|     {0.84, -1.5, 0.075} |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static float tex[2][2][2] = |  | ||||||
| { |  | ||||||
|   { {0, 0}, |  | ||||||
|     {1, 0}}, |  | ||||||
|   { {0, 1}, |  | ||||||
|     {1, 1}} |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* *INDENT-ON* */ |  | ||||||
|  |  | ||||||
| static void |  | ||||||
| teapot(GLint grid, GLdouble scale, GLenum type) |  | ||||||
| { |  | ||||||
|   float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3]; |  | ||||||
|   long i, j, k, l; |  | ||||||
|  |  | ||||||
|   glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT); |  | ||||||
|   glEnable(GL_AUTO_NORMAL); |  | ||||||
|   glEnable(GL_NORMALIZE); |  | ||||||
|   glEnable(GL_MAP2_VERTEX_3); |  | ||||||
|   glEnable(GL_MAP2_TEXTURE_COORD_2); |  | ||||||
|   glPushMatrix(); |  | ||||||
|   glRotatef(270.0, 1.0, 0.0, 0.0); |  | ||||||
|   glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale); |  | ||||||
|   glTranslatef(0.0, 0.0, -1.5); |  | ||||||
|   for (i = 0; i < 10; i++) { |  | ||||||
|     for (j = 0; j < 4; j++) { |  | ||||||
|       for (k = 0; k < 4; k++) { |  | ||||||
|         for (l = 0; l < 3; l++) { |  | ||||||
|           p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; |  | ||||||
|           q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l]; |  | ||||||
|           if (l == 1) |  | ||||||
|             q[j][k][l] *= -1.0; |  | ||||||
|           if (i < 6) { |  | ||||||
|             r[j][k][l] = |  | ||||||
|               cpdata[patchdata[i][j * 4 + (3 - k)]][l]; |  | ||||||
|             if (l == 0) |  | ||||||
|               r[j][k][l] *= -1.0; |  | ||||||
|             s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; |  | ||||||
|             if (l == 0) |  | ||||||
|               s[j][k][l] *= -1.0; |  | ||||||
|             if (l == 1) |  | ||||||
|               s[j][k][l] *= -1.0; |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, |  | ||||||
|       &tex[0][0][0]); |  | ||||||
|     glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, |  | ||||||
|       &p[0][0][0]); |  | ||||||
|     glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0); |  | ||||||
|     glEvalMesh2(type, 0, grid, 0, grid); |  | ||||||
|     glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, |  | ||||||
|       &q[0][0][0]); |  | ||||||
|     glEvalMesh2(type, 0, grid, 0, grid); |  | ||||||
|     if (i < 6) { |  | ||||||
|       glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, |  | ||||||
|         &r[0][0][0]); |  | ||||||
|       glEvalMesh2(type, 0, grid, 0, grid); |  | ||||||
|       glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, |  | ||||||
|         &s[0][0][0]); |  | ||||||
|       glEvalMesh2(type, 0, grid, 0, grid); |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   glPopMatrix(); |  | ||||||
|   glPopAttrib(); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* CENTRY */ |  | ||||||
| void APIENTRY  |  | ||||||
| glutSolidTeapot(GLdouble scale) |  | ||||||
| { |  | ||||||
|   teapot(7, scale, GL_FILL); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void APIENTRY  |  | ||||||
| glutWireTeapot(GLdouble scale) |  | ||||||
| { |  | ||||||
|   teapot(10, scale, GL_LINE); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* ENDCENTRY */ |  | ||||||
| @@ -19,7 +19,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * DOS/DJGPP glut driver v1.2 for Mesa 4.1 |  * DOS/DJGPP glut driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -27,27 +27,19 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
| #include "GL/glut.h" | #include <stdio.h> | ||||||
| #ifndef FX |  | ||||||
|  | #include "glutint.h" | ||||||
| #include "GL/dmesa.h" | #include "GL/dmesa.h" | ||||||
| #else |  | ||||||
| #include "GL/fxmesa.h" |  | ||||||
| #endif |  | ||||||
| #include "internal.h" |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static int window; | GLUTwindow *g_curwin; | ||||||
|  | static GLuint swaptime, swapcount; | ||||||
|  |  | ||||||
| #ifndef FX |  | ||||||
| static DMesaVisual  visual  = NULL; | static DMesaVisual  visual  = NULL; | ||||||
| static DMesaContext context = NULL; | static DMesaContext context = NULL; | ||||||
| static DMesaBuffer  buffer[MAX_WINDOWS]; | static GLUTwindow *windows[MAX_WINDOWS]; | ||||||
| #else |  | ||||||
| static void *visual = NULL; |  | ||||||
| static fxMesaContext context = NULL; |  | ||||||
| static int fx_attrib[32]; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -55,15 +47,11 @@ static void clean (void) | |||||||
| { | { | ||||||
|  int i; |  int i; | ||||||
|  |  | ||||||
|  for (i=0; i<MAX_WINDOWS; i++) { |  for (i=1; i<=MAX_WINDOWS; i++) { | ||||||
|      glutDestroyWindow(i+1); |      glutDestroyWindow(i); | ||||||
|  } |  } | ||||||
| #ifndef FX |  | ||||||
|  if (context) DMesaDestroyContext(context); |  if (context) DMesaDestroyContext(context); | ||||||
|  if (visual)  DMesaDestroyVisual(visual); |  if (visual)  DMesaDestroyVisual(visual); | ||||||
| #else |  | ||||||
|  if (context) fxMesaDestroyContext(context); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  pc_close_stdout(); |  pc_close_stdout(); | ||||||
|  pc_close_stderr(); |  pc_close_stderr(); | ||||||
| @@ -74,187 +62,199 @@ static void clean (void) | |||||||
| int APIENTRY glutCreateWindow (const char *title) | int APIENTRY glutCreateWindow (const char *title) | ||||||
| { | { | ||||||
|  int i; |  int i; | ||||||
|  |  int m8width = (g_init_w + 7) & ~7; | ||||||
|  |  | ||||||
|  if (!visual) { |  if (!visual) { | ||||||
|     int screen_w = DEFAULT_WIDTH; |     if ((visual=DMesaCreateVisual(g_init_x + m8width, g_init_y + g_init_h, g_bpp, g_refresh, | ||||||
|     int screen_h = DEFAULT_HEIGHT; |  | ||||||
|  |  | ||||||
|     if ((g_width<=640) && (g_height<=480)) { |  | ||||||
|        screen_w = 640; |  | ||||||
|        screen_h = 480; |  | ||||||
|     } else if ((g_width<=800) && (g_height<=600)) { |  | ||||||
|        screen_w = 800; |  | ||||||
|        screen_h = 600; |  | ||||||
|     } else if ((g_width<=1024) && (g_height<=768)) { |  | ||||||
|        screen_w = 1024; |  | ||||||
|        screen_h = 768; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| #ifndef FX |  | ||||||
|     if ((visual=DMesaCreateVisual(screen_w, screen_h, DEFAULT_BPP, |  | ||||||
|                                   g_display_mode & GLUT_DOUBLE, |                                   g_display_mode & GLUT_DOUBLE, | ||||||
|  |                                   !(g_display_mode & GLUT_INDEX), | ||||||
|  |                                   g_display_mode & GLUT_ALPHA, | ||||||
|                                   g_display_mode & GLUT_DEPTH  ?DEPTH_SIZE  :0, |                                   g_display_mode & GLUT_DEPTH  ?DEPTH_SIZE  :0, | ||||||
|                                   g_display_mode & GLUT_STENCIL?STENCIL_SIZE:0, |                                   g_display_mode & GLUT_STENCIL?STENCIL_SIZE:0, | ||||||
|                                   g_display_mode & GLUT_ACCUM  ?ACCUM_SIZE  :0))==NULL) { |                                   g_display_mode & GLUT_ACCUM  ?ACCUM_SIZE  :0))==NULL) { | ||||||
|        return 0; |        return 0; | ||||||
|     } |     } | ||||||
|     |  | ||||||
|     if ((context=DMesaCreateContext(visual, NULL))==NULL) { |     if ((context=DMesaCreateContext(visual, NULL))==NULL) { | ||||||
|        DMesaDestroyVisual(visual); |        DMesaDestroyVisual(visual); | ||||||
|        return 0; |        return 0; | ||||||
|     } |     } | ||||||
| #else |  | ||||||
|     i = 0; |  | ||||||
|     if (g_display_mode & GLUT_DOUBLE) fx_attrib[i++] = FXMESA_DOUBLEBUFFER; |  | ||||||
|     if (g_display_mode & GLUT_DEPTH) { fx_attrib[i++] = FXMESA_DEPTH_SIZE; fx_attrib[i++] = DEPTH_SIZE; } |  | ||||||
|     if (g_display_mode & GLUT_STENCIL) { fx_attrib[i++] = FXMESA_STENCIL_SIZE; fx_attrib[i++] = STENCIL_SIZE; } |  | ||||||
|     if (g_display_mode & GLUT_ACCUM) { fx_attrib[i++] = FXMESA_ACCUM_SIZE; fx_attrib[i++] = ACCUM_SIZE; } |  | ||||||
|     fx_attrib[i] = FXMESA_NONE; |  | ||||||
|     if ((context=fxMesaCreateBestContext(-1, screen_w, screen_h, fx_attrib))==NULL) { |  | ||||||
|        return 0; |  | ||||||
|     } |  | ||||||
|     visual = context; |  | ||||||
| #endif |  | ||||||
|      |  | ||||||
|     pc_open_stdout(); |     pc_open_stdout(); | ||||||
|     pc_open_stderr(); |     pc_open_stderr(); | ||||||
|     pc_atexit(clean); |     pc_atexit(clean); | ||||||
|  } |  } | ||||||
|  |  | ||||||
| #ifndef FX |  | ||||||
|  for (i=0; i<MAX_WINDOWS; i++) { |  for (i=0; i<MAX_WINDOWS; i++) { | ||||||
|      if (!buffer[i]) { |      if (windows[i] == NULL) { | ||||||
|         DMesaBuffer b; |         DMesaBuffer b; | ||||||
|       |         GLUTwindow *w; | ||||||
|         if ((b=DMesaCreateBuffer(visual, g_xpos, g_ypos, g_width, g_height))==NULL) { |  | ||||||
|  |         if ((w=(GLUTwindow *)calloc(1, sizeof(GLUTwindow))) == NULL) { | ||||||
|  |            return 0; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if ((b=DMesaCreateBuffer(visual, g_init_x, g_init_y, m8width, g_init_h))==NULL) { | ||||||
|  |            free(w); | ||||||
|            return 0; |            return 0; | ||||||
|         } |         } | ||||||
|         if (!DMesaMakeCurrent(context, b)) { |         if (!DMesaMakeCurrent(context, b)) { | ||||||
|            DMesaDestroyBuffer(b); |            DMesaDestroyBuffer(b); | ||||||
|  |            free(w); | ||||||
|            return 0; |            return 0; | ||||||
|         } |         } | ||||||
|         if (g_mouse) { |  | ||||||
|            pc_mouse_area(g_xpos, g_ypos, g_xpos + g_width - 1, g_ypos + g_height - 1); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         buffer[window = i] = b; |         g_curwin = windows[i] = w; | ||||||
|         return i+1; |  | ||||||
|  |         w->num = ++i; | ||||||
|  |         w->xpos = g_init_x; | ||||||
|  |         w->ypos = g_init_y; | ||||||
|  |         w->width = m8width; | ||||||
|  |         w->height = g_init_h; | ||||||
|  |         w->buffer = b; | ||||||
|  |  | ||||||
|  |         return i; | ||||||
|      } |      } | ||||||
|  } |  } | ||||||
|  |  | ||||||
|  return 0; |  return 0; | ||||||
| #else |  | ||||||
|  fxMesaMakeCurrent(context); |  | ||||||
|  |  | ||||||
|  return 1; |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int APIENTRY glutCreateSubWindow (int win, int x, int y, int width, int height) | int APIENTRY glutCreateSubWindow (int win, int x, int y, int width, int height) | ||||||
| { | { | ||||||
|  return GL_FALSE; |  return GL_FALSE; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutDestroyWindow (int win) | void APIENTRY glutDestroyWindow (int win) | ||||||
| { | { | ||||||
| #ifndef FX |  if (windows[--win]) { | ||||||
|  if (buffer[win-1]) { |     DMesaDestroyBuffer(windows[win]->buffer); | ||||||
|     DMesaDestroyBuffer(buffer[win-1]); |     free(windows[win]); | ||||||
|     buffer[win-1] = NULL; |     windows[win] = NULL; | ||||||
|  } |  } | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutPostRedisplay (void) | void APIENTRY glutPostRedisplay (void) | ||||||
| { | { | ||||||
|  g_redisplay = GL_TRUE; |  g_redisplay = GL_TRUE; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutSwapBuffers (void) | void APIENTRY glutSwapBuffers (void) | ||||||
| { | { | ||||||
|  if (g_mouse) pc_scare_mouse(); |  if (g_curwin->show_mouse) { | ||||||
| #ifndef FX |     /* XXX scare mouse */ | ||||||
|  DMesaSwapBuffers(buffer[window]); |     DMesaSwapBuffers(g_curwin->buffer); | ||||||
| #else |     /* XXX unscare mouse */ | ||||||
|  fxMesaSwapBuffers(); |  } else { | ||||||
| #endif |     DMesaSwapBuffers(g_curwin->buffer); | ||||||
|  if (g_mouse) pc_unscare_mouse(); |  } | ||||||
|  |  | ||||||
|  |  if (g_fps) { | ||||||
|  |     GLint t = glutGet(GLUT_ELAPSED_TIME); | ||||||
|  |     swapcount++; | ||||||
|  |     if (swaptime == 0) | ||||||
|  |        swaptime = t; | ||||||
|  |     else if (t - swaptime > g_fps) { | ||||||
|  |        double time = 0.001 * (t - swaptime); | ||||||
|  |        double fps = (double)swapcount / time; | ||||||
|  |        fprintf(stderr, "GLUT: %d frames in %.2f seconds = %.2f FPS\n", swapcount, time, fps); | ||||||
|  |        swaptime = t; | ||||||
|  |        swapcount = 0; | ||||||
|  |     } | ||||||
|  |  } | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| int APIENTRY glutGetWindow (void) | int APIENTRY glutGetWindow (void) | ||||||
| { | { | ||||||
|  return window + 1; |  return g_curwin->num; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutSetWindow (int win) | void APIENTRY glutSetWindow (int win) | ||||||
| { | { | ||||||
|  window = win - 1; |  g_curwin = windows[win - 1]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutSetWindowTitle (const char *title) | void APIENTRY glutSetWindowTitle (const char *title) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutSetIconTitle (const char *title) | void APIENTRY glutSetIconTitle (const char *title) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutPositionWindow (int x, int y) | void APIENTRY glutPositionWindow (int x, int y) | ||||||
| { | { | ||||||
| #ifndef FX |  if (DMesaMoveBuffer(x, y)) { | ||||||
|  if (DMesaViewport(buffer[window], x, y, g_width, g_height)) { |     g_curwin->xpos = x; | ||||||
|     g_xpos = x; |     g_curwin->ypos = y; | ||||||
|     g_ypos = y; |  | ||||||
|  } |  } | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutReshapeWindow (int width, int height) | void APIENTRY glutReshapeWindow (int width, int height) | ||||||
| { | {  | ||||||
| #ifndef FX |  if (DMesaResizeBuffer(width, height)) { | ||||||
|  if (DMesaViewport(buffer[window], g_xpos, g_ypos, width, height)) { |     g_curwin->width = width; | ||||||
|     g_width = width; |     g_curwin->height = height; | ||||||
|     g_height = height; |     if (g_curwin->reshape) { | ||||||
|     if (reshape_func) { |        g_curwin->reshape(width, height); | ||||||
|        reshape_func(width, height); |  | ||||||
|     } else { |     } else { | ||||||
|        glViewport(0, 0, width, height); |        glViewport(0, 0, width, height); | ||||||
|     } |     } | ||||||
|  } |  } | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void APIENTRY glutFullScreen (void) | ||||||
|  | { | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutPopWindow (void) | void APIENTRY glutPopWindow (void) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutPushWindow (void) | void APIENTRY glutPushWindow (void) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutIconifyWindow (void) | void APIENTRY glutIconifyWindow (void) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutShowWindow (void) | void APIENTRY glutShowWindow (void) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void APIENTRY glutHideWindow (void) | void APIENTRY glutHideWindow (void) | ||||||
| { | { | ||||||
| } | } | ||||||
|   | |||||||
| @@ -121,6 +121,11 @@ EXPORTS | |||||||
| 	glutWireTeapot | 	glutWireTeapot | ||||||
| 	glutWireTetrahedron | 	glutWireTetrahedron | ||||||
| 	glutWireTorus | 	glutWireTorus | ||||||
|  | 	glutStrokeRoman | ||||||
|  | 	glutBitmap9By15 | ||||||
|  | 	glutBitmapHelvetica10 | ||||||
|  | 	glutBitmapHelvetica18 | ||||||
|  | 	glutBitmapTimesRoman24 | ||||||
| ;    __glutSetFCB | ;    __glutSetFCB | ||||||
| ;    __glutGetFCB | ;    __glutGetFCB | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
| #include "glutbitmap.h" | #include "glutbitmap.h" | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutBitmapCharacter(GLUTbitmapFont font, int c) | glutBitmapCharacter(GLUTbitmapFont font, int c) | ||||||
| { | { | ||||||
|   const BitmapCharRec *ch; |   const BitmapCharRec *ch; | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
| #include "glutbitmap.h" | #include "glutbitmap.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| int APIENTRY  | int GLUTAPIENTRY  | ||||||
| glutBitmapWidth(GLUTbitmapFont font, int c) | glutBitmapWidth(GLUTbitmapFont font, int c) | ||||||
| { | { | ||||||
|   BitmapFontPtr fontinfo; |   BitmapFontPtr fontinfo; | ||||||
| @@ -30,7 +30,7 @@ glutBitmapWidth(GLUTbitmapFont font, int c) | |||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| int APIENTRY  | int GLUTAPIENTRY  | ||||||
| glutBitmapLength(GLUTbitmapFont font, const unsigned char *string) | glutBitmapLength(GLUTbitmapFont font, const unsigned char *string) | ||||||
| { | { | ||||||
|   int c, length; |   int c, length; | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ | |||||||
| #define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i))) | #define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i))) | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue) | glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue) | ||||||
| { | { | ||||||
|   GLUTcolormap *cmap, *newcmap; |   GLUTcolormap *cmap, *newcmap; | ||||||
| @@ -126,7 +126,7 @@ glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue) | |||||||
|   XStoreColor(__glutDisplay, cmap->cmap, &color); |   XStoreColor(__glutDisplay, cmap->cmap, &color); | ||||||
| } | } | ||||||
|  |  | ||||||
| GLfloat APIENTRY | GLfloat GLUTAPIENTRY | ||||||
| glutGetColor(int ndx, int comp) | glutGetColor(int ndx, int comp) | ||||||
| { | { | ||||||
|   GLUTcolormap *colormap; |   GLUTcolormap *colormap; | ||||||
| @@ -161,7 +161,7 @@ glutGetColor(int ndx, int comp) | |||||||
|   return colormap->cells[ndx].component[comp]; |   return colormap->cells[ndx].component[comp]; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutCopyColormap(int winnum) | glutCopyColormap(int winnum) | ||||||
| { | { | ||||||
|   GLUTwindow *window = __glutWindowList[winnum - 1]; |   GLUTwindow *window = __glutWindowList[winnum - 1]; | ||||||
|   | |||||||
| @@ -180,7 +180,7 @@ __glutSetCursor(GLUTwindow *window) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutSetCursor(int cursor) | glutSetCursor(int cursor) | ||||||
| { | { | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc) | glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc) | ||||||
| { | { | ||||||
|   __glutCurrentWindow->buttonBox = buttonBoxFunc; |   __glutCurrentWindow->buttonBox = buttonBoxFunc; | ||||||
| @@ -16,7 +16,7 @@ glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc) | |||||||
|     GLUT_DEVICE_MASK_WORK); |     GLUT_DEVICE_MASK_WORK); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutDialsFunc(GLUTdialsCB dialsFunc) | glutDialsFunc(GLUTdialsCB dialsFunc) | ||||||
| { | { | ||||||
|   __glutCurrentWindow->dials = dialsFunc; |   __glutCurrentWindow->dials = dialsFunc; | ||||||
|   | |||||||
| @@ -1478,7 +1478,7 @@ getVisualInfoFromString(char *string, Bool * treatAsSingle, | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutInitDisplayString(const char *string) | glutInitDisplayString(const char *string) | ||||||
| { | { | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|   | |||||||
| @@ -103,13 +103,13 @@ Atom __glutMotifHints = None; | |||||||
| unsigned int __glutModifierMask = (unsigned int) ~0; | unsigned int __glutModifierMask = (unsigned int) ~0; | ||||||
| int __glutWindowDamaged = 0; | int __glutWindowDamaged = 0; | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutIdleFunc(GLUTidleCB idleFunc) | glutIdleFunc(GLUTidleCB idleFunc) | ||||||
| { | { | ||||||
|   __glutIdleFunc = idleFunc; |   __glutIdleFunc = idleFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutTimerFunc(unsigned int interval, GLUTtimerCB timerFunc, int value) | glutTimerFunc(unsigned int interval, GLUTtimerCB timerFunc, int value) | ||||||
| { | { | ||||||
|   GLUTtimer *timer, *other; |   GLUTtimer *timer, *other; | ||||||
| @@ -215,7 +215,7 @@ __glutPostRedisplay(GLUTwindow * window, int layerMask) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutPostRedisplay(void) | glutPostRedisplay(void) | ||||||
| { | { | ||||||
|   __glutPostRedisplay(__glutCurrentWindow, GLUT_REDISPLAY_WORK); |   __glutPostRedisplay(__glutCurrentWindow, GLUT_REDISPLAY_WORK); | ||||||
| @@ -225,7 +225,7 @@ glutPostRedisplay(void) | |||||||
|    glutSetWindow call (entailing an expensive OpenGL context switch), |    glutSetWindow call (entailing an expensive OpenGL context switch), | ||||||
|    particularly useful when multiple windows need redisplays posted at |    particularly useful when multiple windows need redisplays posted at | ||||||
|    the same times.  See also glutPostWindowOverlayRedisplay. */ |    the same times.  See also glutPostWindowOverlayRedisplay. */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutPostWindowRedisplay(int win) | glutPostWindowRedisplay(int win) | ||||||
| { | { | ||||||
|   __glutPostRedisplay(__glutWindowList[win - 1], GLUT_REDISPLAY_WORK); |   __glutPostRedisplay(__glutWindowList[win - 1], GLUT_REDISPLAY_WORK); | ||||||
| @@ -1351,7 +1351,7 @@ __glutProcessWindowWorkLists(void) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutMainLoop(void) | glutMainLoop(void) | ||||||
| { | { | ||||||
| #if !defined(_WIN32) | #if !defined(_WIN32) | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| int APIENTRY  | int GLUTAPIENTRY  | ||||||
| glutExtensionSupported(const char *extension) | glutExtensionSupported(const char *extension) | ||||||
| { | { | ||||||
|   static const GLubyte *extensions = NULL; |   static const GLubyte *extensions = NULL; | ||||||
| @@ -177,7 +177,7 @@ static struct name_address_pair glut_functions[] = { | |||||||
|  |  | ||||||
|  |  | ||||||
| /* XXX This isn't an official GLUT function, yet */ | /* XXX This isn't an official GLUT function, yet */ | ||||||
| void * APIENTRY  | void * GLUTAPIENTRY  | ||||||
| glutGetProcAddress(const char *procName) | glutGetProcAddress(const char *procName) | ||||||
| { | { | ||||||
|    /* Try GLUT functions first */ |    /* Try GLUT functions first */ | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ | |||||||
|  |  | ||||||
| /* Set a Fortran callback function. */ | /* Set a Fortran callback function. */ | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| __glutSetFCB(int which, void *func) | __glutSetFCB(int which, void *func) | ||||||
| { | { | ||||||
| #ifdef SUPPORT_FORTRAN | #ifdef SUPPORT_FORTRAN | ||||||
| @@ -100,7 +100,7 @@ __glutSetFCB(int which, void *func) | |||||||
|  |  | ||||||
| /* Get a Fortran callback function. */ | /* Get a Fortran callback function. */ | ||||||
|  |  | ||||||
| void* APIENTRY | void* GLUTAPIENTRY | ||||||
| __glutGetFCB(int which) | __glutGetFCB(int which) | ||||||
| { | { | ||||||
| #ifdef SUPPORT_FORTRAN | #ifdef SUPPORT_FORTRAN | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutFullScreen(void) | glutFullScreen(void) | ||||||
| { | { | ||||||
|   assert(!__glutCurrentWindow->parent); |   assert(!__glutCurrentWindow->parent); | ||||||
|   | |||||||
| @@ -45,7 +45,7 @@ static char *capstr[] = | |||||||
| }; | }; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| void __cdecl | void | ||||||
| __glutCloseDownGameMode(void) | __glutCloseDownGameMode(void) | ||||||
| { | { | ||||||
|   if (__glutDisplaySettingsChanged) { |   if (__glutDisplaySettingsChanged) { | ||||||
| @@ -59,7 +59,7 @@ __glutCloseDownGameMode(void) | |||||||
|   __glutGameModeWindow = NULL; |   __glutGameModeWindow = NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutLeaveGameMode(void) | glutLeaveGameMode(void) | ||||||
| { | { | ||||||
|   if (__glutGameModeWindow == NULL) { |   if (__glutGameModeWindow == NULL) { | ||||||
| @@ -548,7 +548,7 @@ parseDisplayString(const char *display, int *ncriteria) | |||||||
|   return criteria; |   return criteria; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutGameModeString(const char *string) | glutGameModeString(const char *string) | ||||||
| { | { | ||||||
|   Criterion *criteria; |   Criterion *criteria; | ||||||
| @@ -560,7 +560,7 @@ glutGameModeString(const char *string) | |||||||
|   free(criteria); |   free(criteria); | ||||||
| } | } | ||||||
|  |  | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| glutEnterGameMode(void) | glutEnterGameMode(void) | ||||||
| { | { | ||||||
|   GLUTwindow *window; |   GLUTwindow *window; | ||||||
| @@ -654,7 +654,7 @@ glutEnterGameMode(void) | |||||||
|   return window->num + 1; |   return window->num + 1; | ||||||
| } | } | ||||||
|  |  | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| glutGameModeGet(GLenum mode) | glutGameModeGet(GLenum mode) | ||||||
| { | { | ||||||
|   switch (mode) { |   switch (mode) { | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| int APIENTRY  | int GLUTAPIENTRY  | ||||||
| glutGet(GLenum param) | glutGet(GLenum param) | ||||||
| { | { | ||||||
|   Window win, root; |   Window win, root; | ||||||
|   | |||||||
| @@ -186,7 +186,7 @@ removeArgs(int *argcp, char **argv, int numToRemove) | |||||||
|   *argcp -= numToRemove; |   *argcp -= numToRemove; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutInit(int *argcp, char **argv) | glutInit(int *argcp, char **argv) | ||||||
| { | { | ||||||
|   char *display = NULL; |   char *display = NULL; | ||||||
| @@ -344,7 +344,7 @@ glutInit(int *argcp, char **argv) | |||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)) | __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)) | ||||||
| { | { | ||||||
|   __glutExitFunc = exitfunc; |   __glutExitFunc = exitfunc; | ||||||
| @@ -353,7 +353,7 @@ __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)) | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutInitWindowPosition(int x, int y) | glutInitWindowPosition(int x, int y) | ||||||
| { | { | ||||||
|   __glutInitX = x; |   __glutInitX = x; | ||||||
| @@ -367,7 +367,7 @@ glutInitWindowPosition(int x, int y) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutInitWindowSize(int width, int height) | glutInitWindowSize(int width, int height) | ||||||
| { | { | ||||||
|   __glutInitWidth = width; |   __glutInitWidth = width; | ||||||
| @@ -381,7 +381,7 @@ glutInitWindowSize(int width, int height) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutInitDisplayMode(unsigned int mask) | glutInitDisplayMode(unsigned int mask) | ||||||
| { | { | ||||||
|   __glutDisplayMode = mask; |   __glutDisplayMode = mask; | ||||||
|   | |||||||
| @@ -581,7 +581,7 @@ __glutUpdateInputDeviceMask(GLUTwindow * window) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| glutDeviceGet(GLenum param) | glutDeviceGet(GLenum param) | ||||||
| { | { | ||||||
|   probeDevices(); |   probeDevices(); | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutJoystickFunc(GLUTjoystickCB joystickFunc, int pollInterval) | glutJoystickFunc(GLUTjoystickCB joystickFunc, int pollInterval) | ||||||
| { | { | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| @@ -48,7 +48,7 @@ glutJoystickFunc(GLUTjoystickCB joystickFunc, int pollInterval) | |||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutForceJoystickFunc(void) | glutForceJoystickFunc(void) | ||||||
| { | { | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutKeyboardFunc(GLUTkeyboardCB keyboardFunc) | glutKeyboardFunc(GLUTkeyboardCB keyboardFunc) | ||||||
| { | { | ||||||
|   __glutChangeWindowEventMask(KeyPressMask, |   __glutChangeWindowEventMask(KeyPressMask, | ||||||
| @@ -18,7 +18,7 @@ glutKeyboardFunc(GLUTkeyboardCB keyboardFunc) | |||||||
|   __glutCurrentWindow->keyboard = keyboardFunc; |   __glutCurrentWindow->keyboard = keyboardFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSpecialFunc(GLUTspecialCB specialFunc) | glutSpecialFunc(GLUTspecialCB specialFunc) | ||||||
| { | { | ||||||
|   __glutChangeWindowEventMask(KeyPressMask, |   __glutChangeWindowEventMask(KeyPressMask, | ||||||
|   | |||||||
| @@ -8,13 +8,13 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutIgnoreKeyRepeat(int ignore) | glutIgnoreKeyRepeat(int ignore) | ||||||
| { | { | ||||||
|   __glutCurrentWindow->ignoreKeyRepeat = ignore; |   __glutCurrentWindow->ignoreKeyRepeat = ignore; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSetKeyRepeat(int repeatMode) | glutSetKeyRepeat(int repeatMode) | ||||||
| { | { | ||||||
| #if !defined(_WIN32) | #if !defined(_WIN32) | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutKeyboardUpFunc(GLUTkeyboardCB keyboardUpFunc) | glutKeyboardUpFunc(GLUTkeyboardCB keyboardUpFunc) | ||||||
| { | { | ||||||
|   __glutChangeWindowEventMask(KeyReleaseMask, |   __glutChangeWindowEventMask(KeyReleaseMask, | ||||||
| @@ -18,7 +18,7 @@ glutKeyboardUpFunc(GLUTkeyboardCB keyboardUpFunc) | |||||||
|   __glutCurrentWindow->keyboardUp = keyboardUpFunc; |   __glutCurrentWindow->keyboardUp = keyboardUpFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSpecialUpFunc(GLUTspecialCB specialUpFunc) | glutSpecialUpFunc(GLUTspecialCB specialUpFunc) | ||||||
| { | { | ||||||
|   __glutChangeWindowEventMask(KeyReleaseMask, |   __glutChangeWindowEventMask(KeyReleaseMask, | ||||||
|   | |||||||
| @@ -831,7 +831,7 @@ installMenuCallbacks(void) | |||||||
|   __glutGetMenuItem = getMenuItem; |   __glutGetMenuItem = getMenuItem; | ||||||
| } | } | ||||||
|  |  | ||||||
| int APIENTRY  | int GLUTAPIENTRY  | ||||||
| glutCreateMenu(GLUTselectCB selectFunc) | glutCreateMenu(GLUTselectCB selectFunc) | ||||||
| { | { | ||||||
|   XSetWindowAttributes wa; |   XSetWindowAttributes wa; | ||||||
| @@ -890,7 +890,7 @@ glutCreateMenu(GLUTselectCB selectFunc) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| int APIENTRY  | int GLUTAPIENTRY  | ||||||
| glutGetMenu(void) | glutGetMenu(void) | ||||||
| { | { | ||||||
|   if (__glutCurrentMenu) { |   if (__glutCurrentMenu) { | ||||||
| @@ -900,7 +900,7 @@ glutGetMenu(void) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutSetMenu(int menuid) | glutSetMenu(int menuid) | ||||||
| { | { | ||||||
|   GLUTmenu *menu; |   GLUTmenu *menu; | ||||||
| @@ -940,7 +940,7 @@ __glutSetMenuItem(GLUTmenuItem * item, const char *label, | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutAddMenuEntry(const char *label, int value) | glutAddMenuEntry(const char *label, int value) | ||||||
| { | { | ||||||
|   XSetWindowAttributes wa; |   XSetWindowAttributes wa; | ||||||
| @@ -968,7 +968,7 @@ glutAddMenuEntry(const char *label, int value) | |||||||
|   __glutCurrentMenu->list = entry; |   __glutCurrentMenu->list = entry; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutAddSubMenu(const char *label, int menu) | glutAddSubMenu(const char *label, int menu) | ||||||
| { | { | ||||||
|   XSetWindowAttributes wa; |   XSetWindowAttributes wa; | ||||||
| @@ -997,7 +997,7 @@ glutAddSubMenu(const char *label, int menu) | |||||||
|   __glutCurrentMenu->list = submenu; |   __glutCurrentMenu->list = submenu; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutAttachMenu(int button) | glutAttachMenu(int button) | ||||||
| { | { | ||||||
|   if (__glutMappedMenu) { |   if (__glutMappedMenu) { | ||||||
|   | |||||||
| @@ -29,19 +29,19 @@ | |||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| /* DEPRICATED, use glutMenuStatusFunc instead. */ | /* DEPRICATED, use glutMenuStatusFunc instead. */ | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutMenuStateFunc(GLUTmenuStateCB menuStateFunc) | glutMenuStateFunc(GLUTmenuStateCB menuStateFunc) | ||||||
| { | { | ||||||
|   __glutMenuStatusFunc = (GLUTmenuStatusCB) menuStateFunc; |   __glutMenuStatusFunc = (GLUTmenuStatusCB) menuStateFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc) | glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc) | ||||||
| { | { | ||||||
|   __glutMenuStatusFunc = menuStatusFunc; |   __glutMenuStatusFunc = menuStatusFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutDestroyMenu(int menunum) | glutDestroyMenu(int menunum) | ||||||
| { | { | ||||||
|   GLUTmenu *menu = __glutGetMenuByNum(menunum); |   GLUTmenu *menu = __glutGetMenuByNum(menunum); | ||||||
| @@ -68,7 +68,7 @@ glutDestroyMenu(int menunum) | |||||||
|   free(menu); |   free(menu); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutChangeToMenuEntry(int num, const char *label, int value) | glutChangeToMenuEntry(int num, const char *label, int value) | ||||||
| { | { | ||||||
|   GLUTmenuItem *item; |   GLUTmenuItem *item; | ||||||
| @@ -95,7 +95,7 @@ glutChangeToMenuEntry(int num, const char *label, int value) | |||||||
|   __glutWarning("Current menu has no %d item.", num); |   __glutWarning("Current menu has no %d item.", num); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutChangeToSubMenu(int num, const char *label, int menu) | glutChangeToSubMenu(int num, const char *label, int menu) | ||||||
| { | { | ||||||
|   GLUTmenuItem *item; |   GLUTmenuItem *item; | ||||||
| @@ -122,7 +122,7 @@ glutChangeToSubMenu(int num, const char *label, int menu) | |||||||
|   __glutWarning("Current menu has no %d item.", num); |   __glutWarning("Current menu has no %d item.", num); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutRemoveMenuItem(int num) | glutRemoveMenuItem(int num) | ||||||
| { | { | ||||||
|   GLUTmenuItem *item, **prev, *remaining; |   GLUTmenuItem *item, **prev, *remaining; | ||||||
| @@ -173,7 +173,7 @@ glutRemoveMenuItem(int num) | |||||||
|   __glutWarning("Current menu has no %d item.", num); |   __glutWarning("Current menu has no %d item.", num); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutDetachMenu(int button) | glutDetachMenu(int button) | ||||||
| { | { | ||||||
|   if (__glutMappedMenu) |   if (__glutMappedMenu) | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| glutGetModifiers(void) | glutGetModifiers(void) | ||||||
| { | { | ||||||
|   int modifiers; |   int modifiers; | ||||||
|   | |||||||
| @@ -356,7 +356,7 @@ determineOverlayVisual(int *treatAsSingle, Bool * visAlloced, void **fbc) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutEstablishOverlay(void) | glutEstablishOverlay(void) | ||||||
| { | { | ||||||
|   GLUToverlay *overlay; |   GLUToverlay *overlay; | ||||||
| @@ -458,7 +458,7 @@ glutEstablishOverlay(void) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutRemoveOverlay(void) | glutRemoveOverlay(void) | ||||||
| { | { | ||||||
|   GLUTwindow *window = __glutCurrentWindow; |   GLUTwindow *window = __glutCurrentWindow; | ||||||
| @@ -481,7 +481,7 @@ glutRemoveOverlay(void) | |||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutUseLayer(GLenum layer) | glutUseLayer(GLenum layer) | ||||||
| { | { | ||||||
|   GLUTwindow *window = __glutCurrentWindow; |   GLUTwindow *window = __glutCurrentWindow; | ||||||
| @@ -511,7 +511,7 @@ glutUseLayer(GLenum layer) | |||||||
|   __glutSetWindow(window); |   __glutSetWindow(window); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutPostOverlayRedisplay(void) | glutPostOverlayRedisplay(void) | ||||||
| { | { | ||||||
|   __glutPostRedisplay(__glutCurrentWindow, GLUT_OVERLAY_REDISPLAY_WORK); |   __glutPostRedisplay(__glutCurrentWindow, GLUT_OVERLAY_REDISPLAY_WORK); | ||||||
| @@ -521,13 +521,13 @@ glutPostOverlayRedisplay(void) | |||||||
|    glutSetWindow call (entailing an expensive OpenGL context |    glutSetWindow call (entailing an expensive OpenGL context | ||||||
|    switch), particularly useful when multiple windows need |    switch), particularly useful when multiple windows need | ||||||
|    redisplays posted at the same times. */ |    redisplays posted at the same times. */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutPostWindowOverlayRedisplay(int win) | glutPostWindowOverlayRedisplay(int win) | ||||||
| { | { | ||||||
|   __glutPostRedisplay(__glutWindowList[win - 1], GLUT_OVERLAY_REDISPLAY_WORK); |   __glutPostRedisplay(__glutWindowList[win - 1], GLUT_OVERLAY_REDISPLAY_WORK); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutOverlayDisplayFunc(GLUTdisplayCB displayFunc) | glutOverlayDisplayFunc(GLUTdisplayCB displayFunc) | ||||||
| { | { | ||||||
|   if (!__glutCurrentWindow->overlay) { |   if (!__glutCurrentWindow->overlay) { | ||||||
| @@ -537,7 +537,7 @@ glutOverlayDisplayFunc(GLUTdisplayCB displayFunc) | |||||||
|   __glutCurrentWindow->overlay->display = displayFunc; |   __glutCurrentWindow->overlay->display = displayFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutHideOverlay(void) | glutHideOverlay(void) | ||||||
| { | { | ||||||
|   if (!__glutCurrentWindow->overlay) { |   if (!__glutCurrentWindow->overlay) { | ||||||
| @@ -548,7 +548,7 @@ glutHideOverlay(void) | |||||||
|   __glutCurrentWindow->overlay->shownState = 0; |   __glutCurrentWindow->overlay->shownState = 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutShowOverlay(void) | glutShowOverlay(void) | ||||||
| { | { | ||||||
|   if (!__glutCurrentWindow->overlay) { |   if (!__glutCurrentWindow->overlay) { | ||||||
| @@ -559,7 +559,7 @@ glutShowOverlay(void) | |||||||
|   __glutCurrentWindow->overlay->shownState = 1; |   __glutCurrentWindow->overlay->shownState = 1; | ||||||
| } | } | ||||||
|  |  | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| glutLayerGet(GLenum param) | glutLayerGet(GLenum param) | ||||||
| { | { | ||||||
|   switch (param) { |   switch (param) { | ||||||
|   | |||||||
| @@ -65,7 +65,7 @@ initQuadObj(void) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutWireSphere(GLdouble radius, GLint slices, GLint stacks) | glutWireSphere(GLdouble radius, GLint slices, GLint stacks) | ||||||
| { | { | ||||||
|   QUAD_OBJ_INIT(); |   QUAD_OBJ_INIT(); | ||||||
| @@ -77,7 +77,7 @@ glutWireSphere(GLdouble radius, GLint slices, GLint stacks) | |||||||
|   gluSphere(quadObj, radius, slices, stacks); |   gluSphere(quadObj, radius, slices, stacks); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSolidSphere(GLdouble radius, GLint slices, GLint stacks) | glutSolidSphere(GLdouble radius, GLint slices, GLint stacks) | ||||||
| { | { | ||||||
|   QUAD_OBJ_INIT(); |   QUAD_OBJ_INIT(); | ||||||
| @@ -89,7 +89,7 @@ glutSolidSphere(GLdouble radius, GLint slices, GLint stacks) | |||||||
|   gluSphere(quadObj, radius, slices, stacks); |   gluSphere(quadObj, radius, slices, stacks); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutWireCone(GLdouble base, GLdouble height, | glutWireCone(GLdouble base, GLdouble height, | ||||||
|   GLint slices, GLint stacks) |   GLint slices, GLint stacks) | ||||||
| { | { | ||||||
| @@ -102,7 +102,7 @@ glutWireCone(GLdouble base, GLdouble height, | |||||||
|   gluCylinder(quadObj, base, 0.0, height, slices, stacks); |   gluCylinder(quadObj, base, 0.0, height, slices, stacks); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSolidCone(GLdouble base, GLdouble height, | glutSolidCone(GLdouble base, GLdouble height, | ||||||
|   GLint slices, GLint stacks) |   GLint slices, GLint stacks) | ||||||
| { | { | ||||||
| @@ -160,13 +160,13 @@ drawBox(GLfloat size, GLenum type) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutWireCube(GLdouble size) | glutWireCube(GLdouble size) | ||||||
| { | { | ||||||
|   drawBox(size, GL_LINE_LOOP); |   drawBox(size, GL_LINE_LOOP); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSolidCube(GLdouble size) | glutSolidCube(GLdouble size) | ||||||
| { | { | ||||||
|   drawBox(size, GL_QUADS); |   drawBox(size, GL_QUADS); | ||||||
| @@ -216,7 +216,7 @@ doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, | glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, | ||||||
|   GLint nsides, GLint rings) |   GLint nsides, GLint rings) | ||||||
| { | { | ||||||
| @@ -226,7 +226,7 @@ glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, | |||||||
|   glPopAttrib(); |   glPopAttrib(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, | glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, | ||||||
|   GLint nsides, GLint rings) |   GLint nsides, GLint rings) | ||||||
| { | { | ||||||
| @@ -349,13 +349,13 @@ dodecahedron(GLenum type) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutWireDodecahedron(void) | glutWireDodecahedron(void) | ||||||
| { | { | ||||||
|   dodecahedron(GL_LINE_LOOP); |   dodecahedron(GL_LINE_LOOP); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSolidDodecahedron(void) | glutSolidDodecahedron(void) | ||||||
| { | { | ||||||
|   dodecahedron(GL_TRIANGLE_FAN); |   dodecahedron(GL_TRIANGLE_FAN); | ||||||
| @@ -466,13 +466,13 @@ octahedron(GLenum shadeType) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutWireOctahedron(void) | glutWireOctahedron(void) | ||||||
| { | { | ||||||
|   octahedron(GL_LINE_LOOP); |   octahedron(GL_LINE_LOOP); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSolidOctahedron(void) | glutSolidOctahedron(void) | ||||||
| { | { | ||||||
|   octahedron(GL_TRIANGLES); |   octahedron(GL_TRIANGLES); | ||||||
| @@ -537,13 +537,13 @@ icosahedron(GLenum shadeType) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutWireIcosahedron(void) | glutWireIcosahedron(void) | ||||||
| { | { | ||||||
|   icosahedron(GL_LINE_LOOP); |   icosahedron(GL_LINE_LOOP); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSolidIcosahedron(void) | glutSolidIcosahedron(void) | ||||||
| { | { | ||||||
|   icosahedron(GL_TRIANGLES); |   icosahedron(GL_TRIANGLES); | ||||||
| @@ -581,13 +581,13 @@ tetrahedron(GLenum shadeType) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutWireTetrahedron(void) | glutWireTetrahedron(void) | ||||||
| { | { | ||||||
|   tetrahedron(GL_LINE_LOOP); |   tetrahedron(GL_LINE_LOOP); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSolidTetrahedron(void) | glutSolidTetrahedron(void) | ||||||
| { | { | ||||||
|   tetrahedron(GL_TRIANGLES); |   tetrahedron(GL_TRIANGLES); | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc) | glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc) | ||||||
| { | { | ||||||
|   __glutCurrentWindow->spaceMotion = spaceMotionFunc; |   __glutCurrentWindow->spaceMotion = spaceMotionFunc; | ||||||
| @@ -16,7 +16,7 @@ glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc) | |||||||
|     GLUT_DEVICE_MASK_WORK); |     GLUT_DEVICE_MASK_WORK); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc) | glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc) | ||||||
| { | { | ||||||
|   __glutCurrentWindow->spaceRotate = spaceRotateFunc; |   __glutCurrentWindow->spaceRotate = spaceRotateFunc; | ||||||
| @@ -25,7 +25,7 @@ glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc) | |||||||
|     GLUT_DEVICE_MASK_WORK); |     GLUT_DEVICE_MASK_WORK); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc) | glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc) | ||||||
| { | { | ||||||
|   __glutCurrentWindow->spaceButton = spaceButtonFunc; |   __glutCurrentWindow->spaceButton = spaceButtonFunc; | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
| #include "glutstroke.h" | #include "glutstroke.h" | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutStrokeCharacter(GLUTstrokeFont font, int c) | glutStrokeCharacter(GLUTstrokeFont font, int c) | ||||||
| { | { | ||||||
|   const StrokeCharRec *ch; |   const StrokeCharRec *ch; | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ GLint __glutSwapCount = 0; | |||||||
| GLint __glutSwapTime = 0; | GLint __glutSwapTime = 0; | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSwapBuffers(void) | glutSwapBuffers(void) | ||||||
| { | { | ||||||
|   GLUTwindow *window = __glutCurrentWindow; |   GLUTwindow *window = __glutCurrentWindow; | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
| #include "glutstroke.h" | #include "glutstroke.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| int APIENTRY  | int GLUTAPIENTRY  | ||||||
| glutStrokeWidth(GLUTstrokeFont font, int c) | glutStrokeWidth(GLUTstrokeFont font, int c) | ||||||
| { | { | ||||||
|   StrokeFontPtr fontinfo; |   StrokeFontPtr fontinfo; | ||||||
| @@ -30,7 +30,7 @@ glutStrokeWidth(GLUTstrokeFont font, int c) | |||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| int APIENTRY  | int GLUTAPIENTRY  | ||||||
| glutStrokeLength(GLUTstrokeFont font, const unsigned char *string) | glutStrokeLength(GLUTstrokeFont font, const unsigned char *string) | ||||||
| { | { | ||||||
|   int c, length; |   int c, length; | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
|  |  | ||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc) | glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc) | ||||||
| { | { | ||||||
|   __glutCurrentWindow->tabletMotion = tabletMotionFunc; |   __glutCurrentWindow->tabletMotion = tabletMotionFunc; | ||||||
| @@ -23,7 +23,7 @@ glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc) | glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc) | ||||||
| { | { | ||||||
|   __glutCurrentWindow->tabletButton = tabletButtonFunc; |   __glutCurrentWindow->tabletButton = tabletButtonFunc; | ||||||
|   | |||||||
| @@ -195,13 +195,13 @@ teapot(GLint grid, GLdouble scale, GLenum type) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutSolidTeapot(GLdouble scale) | glutSolidTeapot(GLdouble scale) | ||||||
| { | { | ||||||
|   teapot(7, scale, GL_FILL); |   teapot(7, scale, GL_FILL); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutWireTeapot(GLdouble scale) | glutWireTeapot(GLdouble scale) | ||||||
| { | { | ||||||
|   teapot(10, scale, GL_LINE); |   teapot(10, scale, GL_LINE); | ||||||
|   | |||||||
| @@ -42,7 +42,7 @@ __glutWarning(char *format,...) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutReportErrors(void) | glutReportErrors(void) | ||||||
| { | { | ||||||
|   GLenum error; |   GLenum error; | ||||||
|   | |||||||
| @@ -50,7 +50,7 @@ catchXSGIvcErrors(Display * dpy, XErrorEvent * event) | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| int APIENTRY  | int GLUTAPIENTRY  | ||||||
| glutVideoResizeGet(GLenum param) | glutVideoResizeGet(GLenum param) | ||||||
| { | { | ||||||
| #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) | ||||||
| @@ -160,7 +160,7 @@ glutVideoResizeGet(GLenum param) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutSetupVideoResizing(void) | glutSetupVideoResizing(void) | ||||||
| { | { | ||||||
| #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) | ||||||
| @@ -173,7 +173,7 @@ glutSetupVideoResizing(void) | |||||||
|     __glutFatalError("glutEstablishVideoResizing: video resizing not possible.\n"); |     __glutFatalError("glutEstablishVideoResizing: video resizing not possible.\n"); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutStopVideoResizing(void) | glutStopVideoResizing(void) | ||||||
| { | { | ||||||
| #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) | ||||||
| @@ -188,7 +188,7 @@ glutStopVideoResizing(void) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* ARGSUSED */ | /* ARGSUSED */ | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutVideoResize(int x, int y, int width, int height) | glutVideoResize(int x, int y, int width, int height) | ||||||
| { | { | ||||||
| #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) | ||||||
| @@ -207,7 +207,7 @@ glutVideoResize(int x, int y, int width, int height) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* ARGSUSED */ | /* ARGSUSED */ | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutVideoPan(int x, int y, int width, int height) | glutVideoPan(int x, int y, int width, int height) | ||||||
| { | { | ||||||
| #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) | #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_video_resize) | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutWarpPointer(int x, int y) | glutWarpPointer(int x, int y) | ||||||
| { | { | ||||||
|   XWarpPointer(__glutDisplay, None, __glutCurrentWindow->win, |   XWarpPointer(__glutDisplay, None, __glutCurrentWindow->win, | ||||||
|   | |||||||
| @@ -130,7 +130,7 @@ __glutGetWindow(Window win) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| glutGetWindow(void) | glutGetWindow(void) | ||||||
| { | { | ||||||
|   if (__glutCurrentWindow) { |   if (__glutCurrentWindow) { | ||||||
| @@ -177,7 +177,7 @@ __glutSetWindow(GLUTwindow * window) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSetWindow(int win) | glutSetWindow(int win) | ||||||
| { | { | ||||||
|   GLUTwindow *window; |   GLUTwindow *window; | ||||||
| @@ -695,7 +695,7 @@ __glutCreateWindow(GLUTwindow * parent, | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| glutCreateWindow(const char *title) | glutCreateWindow(const char *title) | ||||||
| { | { | ||||||
|   static int firstWindow = 1; |   static int firstWindow = 1; | ||||||
| @@ -742,7 +742,7 @@ glutCreateWindow(const char *title) | |||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int)) | __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int)) | ||||||
| { | { | ||||||
|   __glutExitFunc = exitfunc; |   __glutExitFunc = exitfunc; | ||||||
| @@ -750,7 +750,7 @@ __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int)) | |||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| glutCreateSubWindow(int win, int x, int y, int width, int height) | glutCreateSubWindow(int win, int x, int y, int width, int height) | ||||||
| { | { | ||||||
|   GLUTwindow *window; |   GLUTwindow *window; | ||||||
| @@ -842,7 +842,7 @@ __glutDestroyWindow(GLUTwindow * window, | |||||||
| } | } | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutDestroyWindow(int win) | glutDestroyWindow(int win) | ||||||
| { | { | ||||||
|   GLUTwindow *window = __glutWindowList[win - 1]; |   GLUTwindow *window = __glutWindowList[win - 1]; | ||||||
| @@ -886,7 +886,7 @@ __glutChangeWindowEventMask(long eventMask, Bool add) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutDisplayFunc(GLUTdisplayCB displayFunc) | glutDisplayFunc(GLUTdisplayCB displayFunc) | ||||||
| { | { | ||||||
|   /* XXX Remove the warning after GLUT 3.0. */ |   /* XXX Remove the warning after GLUT 3.0. */ | ||||||
| @@ -895,7 +895,7 @@ glutDisplayFunc(GLUTdisplayCB displayFunc) | |||||||
|   __glutCurrentWindow->display = displayFunc; |   __glutCurrentWindow->display = displayFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutMouseFunc(GLUTmouseCB mouseFunc) | glutMouseFunc(GLUTmouseCB mouseFunc) | ||||||
| { | { | ||||||
|   if (__glutCurrentWindow->mouse) { |   if (__glutCurrentWindow->mouse) { | ||||||
| @@ -917,7 +917,7 @@ glutMouseFunc(GLUTmouseCB mouseFunc) | |||||||
|   __glutCurrentWindow->mouse = mouseFunc; |   __glutCurrentWindow->mouse = mouseFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutMotionFunc(GLUTmotionCB motionFunc) | glutMotionFunc(GLUTmotionCB motionFunc) | ||||||
| { | { | ||||||
|   /* Hack.  Some window managers (4Dwm by default) will mask |   /* Hack.  Some window managers (4Dwm by default) will mask | ||||||
| @@ -948,7 +948,7 @@ glutMotionFunc(GLUTmotionCB motionFunc) | |||||||
|   __glutCurrentWindow->motion = motionFunc; |   __glutCurrentWindow->motion = motionFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc) | glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc) | ||||||
| { | { | ||||||
|   __glutChangeWindowEventMask(PointerMotionMask, |   __glutChangeWindowEventMask(PointerMotionMask, | ||||||
| @@ -963,7 +963,7 @@ glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc) | |||||||
|   __glutCurrentWindow->passive = passiveMotionFunc; |   __glutCurrentWindow->passive = passiveMotionFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutEntryFunc(GLUTentryCB entryFunc) | glutEntryFunc(GLUTentryCB entryFunc) | ||||||
| { | { | ||||||
|   __glutChangeWindowEventMask(EnterWindowMask | LeaveWindowMask, |   __glutChangeWindowEventMask(EnterWindowMask | LeaveWindowMask, | ||||||
| @@ -974,7 +974,7 @@ glutEntryFunc(GLUTentryCB entryFunc) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutWindowStatusFunc(GLUTwindowStatusCB windowStatusFunc) | glutWindowStatusFunc(GLUTwindowStatusCB windowStatusFunc) | ||||||
| { | { | ||||||
|   __glutChangeWindowEventMask(VisibilityChangeMask, |   __glutChangeWindowEventMask(VisibilityChangeMask, | ||||||
| @@ -995,7 +995,7 @@ visibilityHelper(int status) | |||||||
|     __glutCurrentWindow->visibility(GLUT_VISIBLE); |     __glutCurrentWindow->visibility(GLUT_VISIBLE); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutVisibilityFunc(GLUTvisibilityCB visibilityFunc) | glutVisibilityFunc(GLUTvisibilityCB visibilityFunc) | ||||||
| { | { | ||||||
|   __glutCurrentWindow->visibility = visibilityFunc; |   __glutCurrentWindow->visibility = visibilityFunc; | ||||||
| @@ -1005,7 +1005,7 @@ glutVisibilityFunc(GLUTvisibilityCB visibilityFunc) | |||||||
|     glutWindowStatusFunc(NULL); |     glutWindowStatusFunc(NULL); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutReshapeFunc(GLUTreshapeCB reshapeFunc) | glutReshapeFunc(GLUTreshapeCB reshapeFunc) | ||||||
| { | { | ||||||
|   if (reshapeFunc) { |   if (reshapeFunc) { | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ | |||||||
| #include "glutint.h" | #include "glutint.h" | ||||||
|  |  | ||||||
| /* CENTRY */ | /* CENTRY */ | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutSetWindowTitle(const char *title) | glutSetWindowTitle(const char *title) | ||||||
| { | { | ||||||
|   XTextProperty textprop; |   XTextProperty textprop; | ||||||
| @@ -39,7 +39,7 @@ glutSetWindowTitle(const char *title) | |||||||
|   XFlush(__glutDisplay); |   XFlush(__glutDisplay); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutSetIconTitle(const char *title) | glutSetIconTitle(const char *title) | ||||||
| { | { | ||||||
|   XTextProperty textprop; |   XTextProperty textprop; | ||||||
| @@ -55,7 +55,7 @@ glutSetIconTitle(const char *title) | |||||||
|   XFlush(__glutDisplay); |   XFlush(__glutDisplay); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutPositionWindow(int x, int y) | glutPositionWindow(int x, int y) | ||||||
| { | { | ||||||
|   IGNORE_IN_GAME_MODE(); |   IGNORE_IN_GAME_MODE(); | ||||||
| @@ -65,7 +65,7 @@ glutPositionWindow(int x, int y) | |||||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); |   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutReshapeWindow(int w, int h) | glutReshapeWindow(int w, int h) | ||||||
| { | { | ||||||
|   IGNORE_IN_GAME_MODE(); |   IGNORE_IN_GAME_MODE(); | ||||||
| @@ -78,7 +78,7 @@ glutReshapeWindow(int w, int h) | |||||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); |   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutPopWindow(void) | glutPopWindow(void) | ||||||
| { | { | ||||||
|   IGNORE_IN_GAME_MODE(); |   IGNORE_IN_GAME_MODE(); | ||||||
| @@ -87,7 +87,7 @@ glutPopWindow(void) | |||||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); |   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutPushWindow(void) | glutPushWindow(void) | ||||||
| { | { | ||||||
|   IGNORE_IN_GAME_MODE(); |   IGNORE_IN_GAME_MODE(); | ||||||
| @@ -96,7 +96,7 @@ glutPushWindow(void) | |||||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); |   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutIconifyWindow(void) | glutIconifyWindow(void) | ||||||
| { | { | ||||||
|   IGNORE_IN_GAME_MODE(); |   IGNORE_IN_GAME_MODE(); | ||||||
| @@ -105,7 +105,7 @@ glutIconifyWindow(void) | |||||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); |   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutShowWindow(void) | glutShowWindow(void) | ||||||
| { | { | ||||||
|   IGNORE_IN_GAME_MODE(); |   IGNORE_IN_GAME_MODE(); | ||||||
| @@ -113,7 +113,7 @@ glutShowWindow(void) | |||||||
|   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); |   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY  | void GLUTAPIENTRY  | ||||||
| glutHideWindow(void) | glutHideWindow(void) | ||||||
| { | { | ||||||
|   IGNORE_IN_GAME_MODE(); |   IGNORE_IN_GAME_MODE(); | ||||||
|   | |||||||
| @@ -796,7 +796,7 @@ extern void  __glutUpdateInputDeviceMask(GLUTwindow * window); | |||||||
| extern void __glutDetermineMesaSwapHackSupport(void); | extern void __glutDetermineMesaSwapHackSupport(void); | ||||||
|  |  | ||||||
| /* private routines from glut_gameglut.c */ | /* private routines from glut_gameglut.c */ | ||||||
| extern void GLUTAPIENTRYV __glutCloseDownGameMode(void); | extern void __glutCloseDownGameMode(void); | ||||||
|  |  | ||||||
| /* private variables from glut_swap.c (BrianP) */ | /* private variables from glut_swap.c (BrianP) */ | ||||||
| extern GLint __glutFPS; | extern GLint __glutFPS; | ||||||
|   | |||||||
| @@ -29,13 +29,13 @@ static int menuListSize = 0; | |||||||
| static UINT uniqueMenuHandler = 1; | static UINT uniqueMenuHandler = 1; | ||||||
|  |  | ||||||
| /* DEPRICATED, use glutMenuStatusFunc instead. */ | /* DEPRICATED, use glutMenuStatusFunc instead. */ | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutMenuStateFunc(GLUTmenuStateCB menuStateFunc) | glutMenuStateFunc(GLUTmenuStateCB menuStateFunc) | ||||||
| { | { | ||||||
|   __glutMenuStatusFunc = (GLUTmenuStatusCB) menuStateFunc; |   __glutMenuStatusFunc = (GLUTmenuStatusCB) menuStateFunc; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc) | glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc) | ||||||
| { | { | ||||||
|   __glutMenuStatusFunc = menuStatusFunc; |   __glutMenuStatusFunc = menuStatusFunc; | ||||||
| @@ -231,7 +231,7 @@ menuModificationError(void) | |||||||
|   __glutFatalError("menu manipulation not allowed while menus in use."); |   __glutFatalError("menu manipulation not allowed while menus in use."); | ||||||
| } | } | ||||||
|  |  | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| glutCreateMenu(GLUTselectCB selectFunc) | glutCreateMenu(GLUTselectCB selectFunc) | ||||||
| { | { | ||||||
|   GLUTmenu *menu; |   GLUTmenu *menu; | ||||||
| @@ -259,14 +259,14 @@ glutCreateMenu(GLUTselectCB selectFunc) | |||||||
|   return menuid + 1; |   return menuid + 1; | ||||||
| } | } | ||||||
|  |  | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| __glutCreateMenuWithExit(GLUTselectCB selectFunc, void (__cdecl *exitfunc)(int)) | __glutCreateMenuWithExit(GLUTselectCB selectFunc, void (__cdecl *exitfunc)(int)) | ||||||
| { | { | ||||||
|   __glutExitFunc = exitfunc; |   __glutExitFunc = exitfunc; | ||||||
|   return glutCreateMenu(selectFunc); |   return glutCreateMenu(selectFunc); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutDestroyMenu(int menunum) | glutDestroyMenu(int menunum) | ||||||
| { | { | ||||||
|   GLUTmenu *menu = __glutGetMenuByNum(menunum); |   GLUTmenu *menu = __glutGetMenuByNum(menunum); | ||||||
| @@ -293,7 +293,7 @@ glutDestroyMenu(int menunum) | |||||||
|   free(menu); |   free(menu); | ||||||
| } | } | ||||||
|  |  | ||||||
| int APIENTRY | int GLUTAPIENTRY | ||||||
| glutGetMenu(void) | glutGetMenu(void) | ||||||
| { | { | ||||||
|   if (__glutCurrentMenu) { |   if (__glutCurrentMenu) { | ||||||
| @@ -303,7 +303,7 @@ glutGetMenu(void) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutSetMenu(int menuid) | glutSetMenu(int menuid) | ||||||
| { | { | ||||||
|   GLUTmenu *menu; |   GLUTmenu *menu; | ||||||
| @@ -342,7 +342,7 @@ setMenuItem(GLUTmenuItem * item, const char *label, | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutAddMenuEntry(const char *label, int value) | glutAddMenuEntry(const char *label, int value) | ||||||
| { | { | ||||||
|   GLUTmenuItem *entry; |   GLUTmenuItem *entry; | ||||||
| @@ -361,7 +361,7 @@ glutAddMenuEntry(const char *label, int value) | |||||||
|   __glutCurrentMenu->list = entry; |   __glutCurrentMenu->list = entry; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutAddSubMenu(const char *label, int menu) | glutAddSubMenu(const char *label, int menu) | ||||||
| { | { | ||||||
|   GLUTmenuItem *submenu; |   GLUTmenuItem *submenu; | ||||||
| @@ -386,7 +386,7 @@ glutAddSubMenu(const char *label, int menu) | |||||||
|   __glutCurrentMenu->list = submenu; |   __glutCurrentMenu->list = submenu; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutChangeToMenuEntry(int num, const char *label, int value) | glutChangeToMenuEntry(int num, const char *label, int value) | ||||||
| { | { | ||||||
|   GLUTmenuItem *item; |   GLUTmenuItem *item; | ||||||
| @@ -426,7 +426,7 @@ glutChangeToMenuEntry(int num, const char *label, int value) | |||||||
|   __glutWarning("Current menu has no %d item.", num); |   __glutWarning("Current menu has no %d item.", num); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutChangeToSubMenu(int num, const char *label, int menu) | glutChangeToSubMenu(int num, const char *label, int menu) | ||||||
| { | { | ||||||
|   GLUTmenu *popupmenu; |   GLUTmenu *popupmenu; | ||||||
| @@ -468,7 +468,7 @@ glutChangeToSubMenu(int num, const char *label, int menu) | |||||||
|   __glutWarning("Current menu has no %d item.", num); |   __glutWarning("Current menu has no %d item.", num); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutRemoveMenuItem(int num) | glutRemoveMenuItem(int num) | ||||||
| { | { | ||||||
|   GLUTmenuItem *item, **prev; |   GLUTmenuItem *item, **prev; | ||||||
| @@ -501,7 +501,7 @@ glutRemoveMenuItem(int num) | |||||||
|   __glutWarning("Current menu has no %d item.", num); |   __glutWarning("Current menu has no %d item.", num); | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutAttachMenu(int button) | glutAttachMenu(int button) | ||||||
| { | { | ||||||
|   if (__glutCurrentWindow == __glutGameModeWindow) { |   if (__glutCurrentWindow == __glutGameModeWindow) { | ||||||
| @@ -517,7 +517,7 @@ glutAttachMenu(int button) | |||||||
|   __glutCurrentWindow->menu[button] = __glutCurrentMenu->id + 1; |   __glutCurrentWindow->menu[button] = __glutCurrentMenu->id + 1; | ||||||
| } | } | ||||||
|  |  | ||||||
| void APIENTRY | void GLUTAPIENTRY | ||||||
| glutDetachMenu(int button) | glutDetachMenu(int button) | ||||||
| { | { | ||||||
|   if (__glutMappedMenu) { |   if (__glutMappedMenu) { | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| /* $Id: GLView.cpp,v 1.7 2002/10/17 14:25:30 brianp Exp $ */ | /* $Id: GLView.cpp,v 1.7.2.2 2003/03/30 15:48:48 brianp Exp $ */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  4.1 |  * Version:  5.0 | ||||||
|  *  |  *  | ||||||
|  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | ||||||
|  *  |  *  | ||||||
| @@ -38,7 +38,6 @@ extern "C" { | |||||||
| #include "extensions.h" | #include "extensions.h" | ||||||
| #include "macros.h" | #include "macros.h" | ||||||
| #include "matrix.h" | #include "matrix.h" | ||||||
| #include "mem.h" |  | ||||||
| #include "mmath.h" | #include "mmath.h" | ||||||
| #include "mtypes.h" | #include "mtypes.h" | ||||||
| #include "texformat.h" | #include "texformat.h" | ||||||
| @@ -276,9 +275,7 @@ BGLView::BGLView(BRect rect, char *name, | |||||||
|                                             ); |                                             ); | ||||||
|  |  | ||||||
|    // create core context |    // create core context | ||||||
|    __GLimports imports; |    GLcontext * ctx = _mesa_create_context(visual, NULL, md, GL_FALSE); | ||||||
|    _mesa_init_default_imports(&imports, md); |  | ||||||
|    GLcontext * ctx = _mesa_create_context( visual, NULL, &imports); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|    // create core framebuffer |    // create core framebuffer | ||||||
| @@ -291,7 +288,7 @@ BGLView::BGLView(BRect rect, char *name, | |||||||
|  |  | ||||||
|    _mesa_enable_sw_extensions(ctx); |    _mesa_enable_sw_extensions(ctx); | ||||||
|    _mesa_enable_1_3_extensions(ctx); |    _mesa_enable_1_3_extensions(ctx); | ||||||
|    //_mesa_enable_1_4_extensions(ctx); |    _mesa_enable_1_4_extensions(ctx); | ||||||
|  |  | ||||||
|    /* Initialize the software rasterizer and helper modules. |    /* Initialize the software rasterizer and helper modules. | ||||||
|     */ |     */ | ||||||
| @@ -648,7 +645,7 @@ void MesaDriver::UnlockGL() | |||||||
|  |  | ||||||
| void MesaDriver::SwapBuffers() const | void MesaDriver::SwapBuffers() const | ||||||
| { | { | ||||||
| 	// _mesa_swap_buffers(); |         // _mesa_notifySwapBuffers(m_glcontext); | ||||||
|  |  | ||||||
| 	if (m_bitmap) { | 	if (m_bitmap) { | ||||||
| 		m_bglview->LockLooper(); | 		m_bglview->LockLooper(); | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| /* $Id: t_dd_vbtmp.h,v 1.23 2002/10/29 20:29:05 brianp Exp $ */ | /* $Id: t_dd_vbtmp.h,v 1.23.2.1 2003/01/13 15:47:07 brianp Exp $ */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Mesa 3-D graphics library |  * Mesa 3-D graphics library | ||||||
|  * Version:  4.1 |  * Version:  5.0.1 | ||||||
|  * |  * | ||||||
|  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. |  * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved. | ||||||
|  * |  * | ||||||
|  * Permission is hereby granted, free of charge, to any person obtaining a |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  * copy of this software and associated documentation files (the "Software"), |  * copy of this software and associated documentation files (the "Software"), | ||||||
| @@ -216,7 +216,7 @@ static void TAG(emit)( GLcontext *ctx, | |||||||
|       } |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|    if (VB->importable_data) { |    if (VB->importable_data || (DO_SPEC && !spec_stride) || (DO_FOG && !fog_stride)) { | ||||||
|       /* May have nonstandard strides: |       /* May have nonstandard strides: | ||||||
|        */ |        */ | ||||||
|       if (start) { |       if (start) { | ||||||
| @@ -235,7 +235,7 @@ static void TAG(emit)( GLcontext *ctx, | |||||||
| 	    STRIDE_4UB(spec, start * spec_stride); | 	    STRIDE_4UB(spec, start * spec_stride); | ||||||
| 	 if (DO_FOG) | 	 if (DO_FOG) | ||||||
| 	    /*STRIDE_F(fog, start * fog_stride);*/ | 	    /*STRIDE_F(fog, start * fog_stride);*/ | ||||||
| 	    fog =  (GLfloat (*)[4])((GLfloat *)fog + start * fog_stride); | 	    fog =  (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       for (i=start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) { |       for (i=start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) { | ||||||
| @@ -271,7 +271,7 @@ static void TAG(emit)( GLcontext *ctx, | |||||||
| 	 if (DO_FOG) { | 	 if (DO_FOG) { | ||||||
| 	    v->v.specular.alpha = fog[0][0] * 255.0; | 	    v->v.specular.alpha = fog[0][0] * 255.0; | ||||||
| 	    /*STRIDE_F(fog, fog_stride);*/ | 	    /*STRIDE_F(fog, fog_stride);*/ | ||||||
| 	    fog =  (GLfloat (*)[4])((GLfloat *)fog +  fog_stride); | 	    fog =  (GLfloat (*)[4])((GLubyte *)fog + fog_stride); | ||||||
| 	 } | 	 } | ||||||
| 	 if (DO_TEX0) { | 	 if (DO_TEX0) { | ||||||
| 	    v->v.u0 = tc0[0][0]; | 	    v->v.u0 = tc0[0][0]; | ||||||
|   | |||||||
							
								
								
									
										199
									
								
								src/mesa/drivers/dos/blit.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										199
									
								
								src/mesa/drivers/dos/blit.S
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,199 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  4.0 | ||||||
|  |  *  | ||||||
|  |  * Copyright (C) 1999  Brian Paul   All Rights Reserved. | ||||||
|  |  *  | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  *  | ||||||
|  |  * The above copyright notice and this permission notice shall be included | ||||||
|  |  * in all copies or substantial portions of the Software. | ||||||
|  |  *  | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  |  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  |  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP device driver v1.3 for Mesa | ||||||
|  |  * | ||||||
|  |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 		.file	"blit.S" | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * extern unsigned int vesa_gran_mask, vesa_gran_shift; | ||||||
|  |  * extern int vl_video_selector; | ||||||
|  |  | ||||||
|  |  * extern void *vl_current_draw_buffer; | ||||||
|  |  * extern int vl_current_stride, vl_current_height; | ||||||
|  |  * extern int vl_current_offset, vl_current_delta; | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | 		.text | ||||||
|  |  | ||||||
|  | /* Desc: VESA bank switching routine (BIOS) | ||||||
|  |  * | ||||||
|  |  * In  : EBX=0, EDX = bank number | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: thrashes EAX | ||||||
|  |  */ | ||||||
|  | 		.p2align 5,,31 | ||||||
|  | _vesa_swbankBIOS: | ||||||
|  | 		movw	$0x4f05, %ax | ||||||
|  | 		int	$0x10 | ||||||
|  | 		ret | ||||||
|  |  | ||||||
|  | 		.p2align 2,,3 | ||||||
|  | 		.global	_vesa_swbank | ||||||
|  | _vesa_swbank:	.long	_vesa_swbankBIOS | ||||||
|  |  | ||||||
|  | /* Desc: void vesa_b_dump_virtual (void); | ||||||
|  |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: uses current draw buffer | ||||||
|  |  */ | ||||||
|  | 		.p2align 5,,31 | ||||||
|  | 		.global	_vesa_b_dump_virtual | ||||||
|  | _vesa_b_dump_virtual: | ||||||
|  | 		cld | ||||||
|  | 		pushl	%es | ||||||
|  | 		pushl	%ebx | ||||||
|  | 		pushl	%esi | ||||||
|  | 		pushl	%edi | ||||||
|  | 		pushl	%ebp | ||||||
|  | 		movl	_vl_video_selector, %es | ||||||
|  | 		movl	_vl_current_draw_buffer, %esi | ||||||
|  | 		movl	_vl_current_offset, %edi | ||||||
|  | 		movl	_vesa_gran_shift, %ecx | ||||||
|  | 		movl	_vesa_gran_mask, %ebp | ||||||
|  | 		movl	%edi, %edx | ||||||
|  | 		xorl	%ebx, %ebx | ||||||
|  | 		andl	%ebp, %edi | ||||||
|  | 		shrl	%cl, %edx | ||||||
|  | 		incl	%ebp | ||||||
|  | 		call	*_vesa_swbank | ||||||
|  | 		movl	_vl_current_stride, %ecx | ||||||
|  | 		movl	_vl_current_height, %eax | ||||||
|  | 		movl	_vl_current_delta, %ebx | ||||||
|  | 		shrl	$2, %ecx | ||||||
|  | 		.balign	4 | ||||||
|  | 	0: | ||||||
|  | 		pushl	%ecx | ||||||
|  | 		.balign	4 | ||||||
|  | 	1: | ||||||
|  | 		cmpl	%ebp, %edi | ||||||
|  | 		jb	2f | ||||||
|  | 		pushl	%eax | ||||||
|  | 		pushl	%ebx | ||||||
|  | 		incl	%edx | ||||||
|  | 		xorl	%ebx, %ebx | ||||||
|  | 		call	*_vesa_swbank | ||||||
|  | 		popl	%ebx | ||||||
|  | 		popl	%eax | ||||||
|  | 		subl	%ebp, %edi | ||||||
|  | 		.balign	4 | ||||||
|  | 	2: | ||||||
|  | 		movsl | ||||||
|  | 		decl	%ecx | ||||||
|  | 		jnz	1b | ||||||
|  | 		popl	%ecx | ||||||
|  | 		addl	%ebx, %edi | ||||||
|  | 		decl	%eax | ||||||
|  | 		jnz	0b | ||||||
|  | 		popl	%ebp | ||||||
|  | 		popl	%edi | ||||||
|  | 		popl	%esi | ||||||
|  | 		popl	%ebx | ||||||
|  | 		popl	%es | ||||||
|  | 		ret | ||||||
|  |  | ||||||
|  | /* Desc: void vesa_l_dump_virtual (void); | ||||||
|  |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: uses current draw buffer | ||||||
|  |  */ | ||||||
|  | 		.p2align 5,,31 | ||||||
|  | 		.global	_vesa_l_dump_virtual | ||||||
|  | _vesa_l_dump_virtual: | ||||||
|  | 		cld | ||||||
|  | 		pushl	%es | ||||||
|  | 		pushl	%esi | ||||||
|  | 		pushl	%edi | ||||||
|  | 		movl	_vl_video_selector, %es | ||||||
|  | 		movl	_vl_current_draw_buffer, %esi | ||||||
|  | 		movl	_vl_current_offset, %edi | ||||||
|  | 		movl	_vl_current_stride, %ecx | ||||||
|  | 		movl	_vl_current_height, %edx | ||||||
|  | 		movl	_vl_current_delta, %eax | ||||||
|  | 		shrl	$2, %ecx | ||||||
|  | 		.balign	4 | ||||||
|  | 	0: | ||||||
|  | 		pushl	%ecx | ||||||
|  | 		rep;	movsl | ||||||
|  | 		popl	%ecx | ||||||
|  | 		addl	%eax, %edi | ||||||
|  | 		decl	%edx | ||||||
|  | 		jnz	0b | ||||||
|  | 		popl	%edi | ||||||
|  | 		popl	%esi | ||||||
|  | 		popl	%es | ||||||
|  | 		ret | ||||||
|  |  | ||||||
|  | /* Desc: void vesa_l_dump_virtual_mmx (void); | ||||||
|  |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: uses current draw buffer | ||||||
|  |  */ | ||||||
|  | 		.p2align 5,,31 | ||||||
|  | 		.global	_vesa_l_dump_virtual_mmx | ||||||
|  | _vesa_l_dump_virtual_mmx: | ||||||
|  | #ifdef USE_MMX_ASM | ||||||
|  | 		pushl	%esi | ||||||
|  | 		pushl	%edi | ||||||
|  | 		movl	_vl_video_selector, %fs | ||||||
|  | 		movl	_vl_current_draw_buffer, %esi | ||||||
|  | 		movl	_vl_current_offset, %edi | ||||||
|  | 		movl	_vl_current_stride, %ecx | ||||||
|  | 		movl	_vl_current_height, %edx | ||||||
|  | 		movl	_vl_current_delta, %eax | ||||||
|  | 		shrl	$3, %ecx | ||||||
|  | 		.balign	4 | ||||||
|  | 	0: | ||||||
|  | 		pushl	%ecx | ||||||
|  | 		.balign	4 | ||||||
|  | 	1: | ||||||
|  | 		movq	(%esi), %mm0 | ||||||
|  | 		addl	$8, %esi | ||||||
|  | 		movq	%mm0, %fs:(%edi) | ||||||
|  | 		addl	$8, %edi | ||||||
|  | 		decl	%ecx | ||||||
|  | 		jnz	1b | ||||||
|  | 		popl	%ecx | ||||||
|  | 		addl	%eax, %edi | ||||||
|  | 		decl	%edx | ||||||
|  | 		jnz	0b | ||||||
|  | 		popl	%edi | ||||||
|  | 		popl	%esi | ||||||
|  | 		emms | ||||||
|  | #endif | ||||||
|  | 		ret | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -23,7 +23,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * DOS/DJGPP device driver v1.1 for Mesa 4.0 |  * DOS/DJGPP device driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -33,7 +33,7 @@ | |||||||
|  |  | ||||||
| #include <dpmi.h> | #include <dpmi.h> | ||||||
|  |  | ||||||
| #include "dpmiint.h" | #include "internal.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -46,7 +46,7 @@ | |||||||
| /* _create_linear_mapping: | /* _create_linear_mapping: | ||||||
|  *  Maps a physical address range into linear memory. |  *  Maps a physical address range into linear memory. | ||||||
|  */ |  */ | ||||||
| static int _create_linear_mapping (unsigned long *linear, unsigned long physaddr, int size) | int _create_linear_mapping (unsigned long *linear, unsigned long physaddr, int size) | ||||||
| { | { | ||||||
|  __dpmi_meminfo meminfo; |  __dpmi_meminfo meminfo; | ||||||
|  |  | ||||||
| @@ -71,7 +71,7 @@ static int _create_linear_mapping (unsigned long *linear, unsigned long physaddr | |||||||
| /* _remove_linear_mapping: | /* _remove_linear_mapping: | ||||||
|  *  Frees the DPMI resources being used to map a linear address range. |  *  Frees the DPMI resources being used to map a linear address range. | ||||||
|  */ |  */ | ||||||
| static void _remove_linear_mapping (unsigned long *linear) | void _remove_linear_mapping (unsigned long *linear) | ||||||
| { | { | ||||||
|  __dpmi_meminfo meminfo; |  __dpmi_meminfo meminfo; | ||||||
|  |  | ||||||
| @@ -127,3 +127,22 @@ void _remove_selector (int *segment) | |||||||
|     *segment = 0; |     *segment = 0; | ||||||
|  } |  } | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: retrieve CPU MMX capability | ||||||
|  |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : FALSE if CPU cannot do MMX | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | int _can_mmx (void) | ||||||
|  | { | ||||||
|  | #ifdef USE_MMX_ASM | ||||||
|  |  extern int _mesa_identify_x86_cpu_features (void); | ||||||
|  |  return (_mesa_identify_x86_cpu_features() & 0x00800000); | ||||||
|  | #else | ||||||
|  |  return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * DOS/DJGPP device driver v1.1 for Mesa 4.0 |  * DOS/DJGPP device driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -31,8 +31,10 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| #ifndef VIDEOINT_H_included | #ifndef INTERNAL_H_included | ||||||
| #define VIDEOINT_H_included | #define INTERNAL_H_included | ||||||
|  | 
 | ||||||
|  | #include "../mmath.h" | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * general purpose defines, etc. |  * general purpose defines, etc. | ||||||
| @@ -72,28 +74,56 @@ typedef struct vl_mode { | |||||||
|  * video driver structure |  * video driver structure | ||||||
|  */ |  */ | ||||||
| typedef struct { | typedef struct { | ||||||
|         vl_mode *(*getmodes) (void); |         vl_mode *(*init) (void); | ||||||
|         int (*entermode) (vl_mode *p, int refresh); |         int (*entermode) (vl_mode *p, int refresh); | ||||||
|  |         void (*blit) (void); | ||||||
|  |         void (*setCI_f) (int index, float red, float green, float blue); | ||||||
|  |         void (*setCI_i) (int index, int red, int green, int blue); | ||||||
|  |         int (*get) (int pname, int *params); | ||||||
|         void (*restore) (void); |         void (*restore) (void); | ||||||
|         void (*finit) (void); |         void (*fini) (void); | ||||||
| } vl_driver; | } vl_driver; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  |  * memory mapping | ||||||
|  |  */ | ||||||
|  | int _create_linear_mapping (unsigned long *linear, unsigned long physaddr, int size); | ||||||
|  | void _remove_linear_mapping (unsigned long *linear); | ||||||
|  | int _create_selector (int *segment, unsigned long base, int size); | ||||||
|  | void _remove_selector (int *segment); | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * system routines | ||||||
|  |  */ | ||||||
|  | int _can_mmx (void); | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * asm routines to deal with virtual buffering |  * asm routines to deal with virtual buffering | ||||||
|  */ |  */ | ||||||
|  | extern void v_clear8 (int color); | ||||||
| #define v_clear15 v_clear16 | #define v_clear15 v_clear16 | ||||||
| extern void v_clear16 (void *buffer, int bytes, int color); | extern void v_clear16 (int color); | ||||||
| extern void v_clear32 (void *buffer, int bytes, int color); | extern void v_clear24 (int color); | ||||||
| extern void v_clear24 (void *buffer, int bytes, int color); | extern void v_clear32 (int color); | ||||||
| 
 | 
 | ||||||
| extern void b_dump_virtual (void *buffer, int stride, int height); | extern void v_clear8_mmx (int color); | ||||||
| extern void l_dump_virtual (void *buffer, int stride, int height); | #define v_clear15_mmx v_clear16_mmx | ||||||
|  | extern void v_clear16_mmx (int color); | ||||||
|  | extern void v_clear24_mmx (int color); | ||||||
|  | extern void v_clear32_mmx (int color); | ||||||
| 
 | 
 | ||||||
|  | extern void v_rect8 (int x, int y, int width, int height, int color); | ||||||
|  | #define v_rect15 v_rect16 | ||||||
|  | extern void v_rect16 (int x, int y, int width, int height, int color); | ||||||
|  | extern void v_rect24 (int x, int y, int width, int height, int color); | ||||||
|  | extern void v_rect32 (int x, int y, int width, int height, int color); | ||||||
|  | 
 | ||||||
|  | extern void v_putpixel8 (unsigned int offset, int color); | ||||||
| #define v_putpixel15 v_putpixel16 | #define v_putpixel15 v_putpixel16 | ||||||
| extern void v_putpixel16 (void *buffer, int offset, int color); | extern void v_putpixel16 (unsigned int offset, int color); | ||||||
| extern void v_putpixel24 (void *buffer, int offset, int color); | extern void v_putpixel24 (unsigned int offset, int color); | ||||||
| extern void v_putpixel32 (void *buffer, int offset, int color); | extern void v_putpixel32 (unsigned int offset, int color); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
							
								
								
									
										377
									
								
								src/mesa/drivers/dos/mga/m_ttemp.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										377
									
								
								src/mesa/drivers/dos/mga/m_ttemp.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,377 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  5.0 | ||||||
|  |  *  | ||||||
|  |  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | ||||||
|  |  *  | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  *  | ||||||
|  |  * The above copyright notice and this permission notice shall be included | ||||||
|  |  * in all copies or substantial portions of the Software. | ||||||
|  |  *  | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  |  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  |  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP device driver v1.3 for Mesa  --  MGA2064W triangle template | ||||||
|  |  * | ||||||
|  |  *  Copyright (c) 2003 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Triangle Rasterizer Template | ||||||
|  |  * | ||||||
|  |  * This file is #include'd to generate custom triangle rasterizers. | ||||||
|  |  * | ||||||
|  |  * The following macros may be defined to indicate what auxillary information | ||||||
|  |  * must be interplated across the triangle: | ||||||
|  |  *    INTERP_Z        - if defined, interpolate Z values | ||||||
|  |  *    INTERP_RGB      - if defined, interpolate RGB values | ||||||
|  |  * | ||||||
|  |  *    TAG             - function name | ||||||
|  |  *    CULL            - enable culling for: 0=no, 1=back, -1=front | ||||||
|  |  * | ||||||
|  |  *    SETUP_CODE      - to be executed once per triangle (usually HW init) | ||||||
|  |  * | ||||||
|  |  * For flatshaded primitives, the provoking vertex is the final one. | ||||||
|  |  * This code was designed for the origin to be in the upper-left corner. | ||||||
|  |  * | ||||||
|  |  * Inspired by triangle rasterizer code written by Brian Paul. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #define TRI_SWAP(a, b)        \ | ||||||
|  | do {                          \ | ||||||
|  |     const MGAvertex *tmp = a; \ | ||||||
|  |     a = b;                    \ | ||||||
|  |     b = tmp;                  \ | ||||||
|  | } while (0) | ||||||
|  |  | ||||||
|  | void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v3) | ||||||
|  | { | ||||||
|  |  int area; | ||||||
|  |  int x1, y1, x2, y2, x3, y3; | ||||||
|  |  int eMaj_dx, eMaj_dy, eBot_dx, eBot_dy, eTop_dx, eTop_dy; | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  | #define FIFO_CNT_RGB 3 | ||||||
|  |  int eMaj_dr, eBot_dr, eMaj_dg, eBot_dg, eMaj_db, eBot_db; | ||||||
|  |  int drdx, drdy, dgdx, dgdy, dbdx, dbdy; | ||||||
|  | #else | ||||||
|  | #define FIFO_CNT_RGB 0 | ||||||
|  | #endif | ||||||
|  | #ifdef INTERP_Z | ||||||
|  | #define FIFO_CNT_Z 1 | ||||||
|  |  int dzdx, dzdy; | ||||||
|  |  int eMaj_dz, eBot_dz; | ||||||
|  |  int z1, z2, z3; | ||||||
|  | #else | ||||||
|  | #define FIFO_CNT_Z 0 | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #if defined(INTERP_Z) || defined(INTERP_RGB) | ||||||
|  |  double one_area; | ||||||
|  | #ifndef INTERP_RGB | ||||||
|  |  int red = v3->color[0]; | ||||||
|  |  int green = v3->color[1]; | ||||||
|  |  int blue = v3->color[2]; | ||||||
|  | #endif | ||||||
|  | #else | ||||||
|  |  unsigned long color = mga_mixrgb_full(v3->color); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  int sgn = 0; | ||||||
|  |  | ||||||
|  |  /* sort along the vertical axis */ | ||||||
|  |  if (v2->win[1] < v1->win[1]) { | ||||||
|  |     TRI_SWAP(v1, v2); | ||||||
|  | #ifdef CULL | ||||||
|  |     cull = -cull; | ||||||
|  | #endif | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  if (v3->win[1] < v1->win[1]) { | ||||||
|  |     TRI_SWAP(v1, v3); | ||||||
|  |     TRI_SWAP(v2, v3); | ||||||
|  |  } else if (v3->win[1] < v2->win[1]) { | ||||||
|  |     TRI_SWAP(v2, v3); | ||||||
|  | #ifdef CULL | ||||||
|  |     cull = -cull; | ||||||
|  | #endif     | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  x1 = v1->win[0]; | ||||||
|  |  y1 = v1->win[1]; | ||||||
|  |  x2 = v2->win[0]; | ||||||
|  |  y2 = v2->win[1]; | ||||||
|  |  x3 = v3->win[0]; | ||||||
|  |  y3 = v3->win[1]; | ||||||
|  |  | ||||||
|  |  /* compute deltas for each edge */ | ||||||
|  |  eMaj_dx = x3 - x1; | ||||||
|  |  eMaj_dy = y3 - y1; | ||||||
|  |  eBot_dx = x2 - x1; | ||||||
|  |  eBot_dy = y2 - y1; | ||||||
|  |  eTop_dx = x3 - x2; | ||||||
|  |  eTop_dy = y3 - y2; | ||||||
|  |  | ||||||
|  |  /* compute area */ | ||||||
|  |  if ((area = eMaj_dx * eBot_dy - eBot_dx * eMaj_dy) == 0) { | ||||||
|  |     return; | ||||||
|  |  } | ||||||
|  | #ifdef CULL | ||||||
|  |  if ((area * cull) > 0) { | ||||||
|  |     return; | ||||||
|  |  } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  mga_select(); | ||||||
|  |  | ||||||
|  |  /* set engine state */ | ||||||
|  | #ifdef SETUP_CODE | ||||||
|  |  SETUP_CODE | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  /* draw lower triangle */ | ||||||
|  | #if defined(INTERP_Z) || defined(INTERP_RGB) | ||||||
|  |  one_area = (double)(1<<15) / (double)area; | ||||||
|  |  mga_fifo(1); | ||||||
|  | #else | ||||||
|  |  mga_fifo(2); | ||||||
|  |  mga_outl(M_FCOL, color); | ||||||
|  | #endif | ||||||
|  |  mga_outl(M_YDST, y1); | ||||||
|  |  | ||||||
|  | #ifdef INTERP_Z | ||||||
|  |  z1 = v1->win[2]; | ||||||
|  |  z2 = v2->win[2]; | ||||||
|  |  z3 = v3->win[2]; | ||||||
|  |  | ||||||
|  |  /* compute d?/dx and d?/dy derivatives */ | ||||||
|  |  eMaj_dz = z3 - z1; | ||||||
|  |  eBot_dz = z2 - z1; | ||||||
|  |  dzdx = (eMaj_dz * eBot_dy - eMaj_dy * eBot_dz) * one_area; | ||||||
|  |  dzdy = (eMaj_dx * eBot_dz - eMaj_dz * eBot_dx) * one_area; | ||||||
|  |  | ||||||
|  | #ifndef INTERP_RGB | ||||||
|  |  mga_fifo(11); | ||||||
|  |  mga_outl(M_DR2, dzdx); | ||||||
|  |  mga_outl(M_DR3, dzdy); | ||||||
|  |  mga_outl(M_DR4, red<<15); | ||||||
|  |  mga_outl(M_DR6, 0); | ||||||
|  |  mga_outl(M_DR7, 0); | ||||||
|  |  mga_outl(M_DR8, green<<15); | ||||||
|  |  mga_outl(M_DR10, 0); | ||||||
|  |  mga_outl(M_DR11, 0); | ||||||
|  |  mga_outl(M_DR12, blue<<15); | ||||||
|  |  mga_outl(M_DR14, 0); | ||||||
|  |  mga_outl(M_DR15, 0); | ||||||
|  | #else | ||||||
|  |  mga_fifo(2); | ||||||
|  |  mga_outl(M_DR2, dzdx); | ||||||
|  |  mga_outl(M_DR3, dzdy); | ||||||
|  | #endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  |  /* compute color deltas */ | ||||||
|  |  eMaj_dr = v3->color[0] - v1->color[0]; | ||||||
|  |  eBot_dr = v2->color[0] - v1->color[0]; | ||||||
|  |  eMaj_dg = v3->color[1] - v1->color[1]; | ||||||
|  |  eBot_dg = v2->color[1] - v1->color[1]; | ||||||
|  |  eMaj_db = v3->color[2] - v1->color[2]; | ||||||
|  |  eBot_db = v2->color[2] - v1->color[2]; | ||||||
|  |  | ||||||
|  |  /* compute color increments */ | ||||||
|  |  drdx = (eMaj_dr * eBot_dy - eMaj_dy * eBot_dr) * one_area; | ||||||
|  |  drdy = (eMaj_dx * eBot_dr - eMaj_dr * eBot_dx) * one_area; | ||||||
|  |  dgdx = (eMaj_dg * eBot_dy - eMaj_dy * eBot_dg) * one_area; | ||||||
|  |  dgdy = (eMaj_dx * eBot_dg - eMaj_dg * eBot_dx) * one_area; | ||||||
|  |  dbdx = (eMaj_db * eBot_dy - eMaj_dy * eBot_db) * one_area; | ||||||
|  |  dbdy = (eMaj_dx * eBot_db - eMaj_db * eBot_dx) * one_area; | ||||||
|  |  | ||||||
|  |  mga_fifo(6); | ||||||
|  |  mga_outl(M_DR6, drdx); | ||||||
|  |  mga_outl(M_DR7, drdy); | ||||||
|  |  mga_outl(M_DR10, dgdx); | ||||||
|  |  mga_outl(M_DR11, dgdy); | ||||||
|  |  mga_outl(M_DR14, dbdx); | ||||||
|  |  mga_outl(M_DR15, dbdy); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  if (area > 0) { /* major edge on the right */ | ||||||
|  |     if (eBot_dy) { /* have lower triangle */ | ||||||
|  |        mga_fifo(9 + FIFO_CNT_Z + FIFO_CNT_RGB); | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR0, eBot_dy); | ||||||
|  |        if (x2 < x1) { | ||||||
|  |           mga_outl(M_AR1, eBot_dx + eBot_dy - 1); | ||||||
|  |           mga_outl(M_AR2, eBot_dx); | ||||||
|  |           sgn |= M_SDXL; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR1, -eBot_dx); | ||||||
|  |           mga_outl(M_AR2, -eBot_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR6, eMaj_dy); | ||||||
|  |        if (x3 < x1) { | ||||||
|  |           mga_outl(M_AR4, eMaj_dx + eMaj_dy - 1); | ||||||
|  |           mga_outl(M_AR5, eMaj_dx); | ||||||
|  |           sgn |= M_SDXR; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR4, -eMaj_dx); | ||||||
|  |           mga_outl(M_AR5, -eMaj_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_FXBNDRY, (x1<<16) | x1); | ||||||
|  | #ifdef INTERP_Z | ||||||
|  |        mga_outl(M_DR0, z1<<15); | ||||||
|  | #endif | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  |        mga_outl(M_DR4, v1->color[0]<<15); | ||||||
|  |        mga_outl(M_DR8, v1->color[1]<<15); | ||||||
|  |        mga_outl(M_DR12, v1->color[2]<<15); | ||||||
|  | #endif | ||||||
|  |        mga_outl(M_SGN, sgn); | ||||||
|  |        mga_outl(M_LEN | M_EXEC, eBot_dy); | ||||||
|  |     } else { /* no lower triangle */ | ||||||
|  |        mga_fifo(4 + FIFO_CNT_Z + FIFO_CNT_RGB); | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR6, eMaj_dy); | ||||||
|  |        if (x3 < x1) { | ||||||
|  |           mga_outl(M_AR4, eMaj_dx + eMaj_dy - 1); | ||||||
|  |           mga_outl(M_AR5, eMaj_dx); | ||||||
|  |           sgn |= M_SDXR; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR4, -eMaj_dx); | ||||||
|  |           mga_outl(M_AR5, -eMaj_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_FXBNDRY, (x1<<16) | x2); | ||||||
|  | #ifdef INTERP_Z | ||||||
|  |        mga_outl(M_DR0, z2<<15); | ||||||
|  | #endif | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  |        mga_outl(M_DR4, v2->color[0]<<15); | ||||||
|  |        mga_outl(M_DR8, v2->color[1]<<15); | ||||||
|  |        mga_outl(M_DR12, v2->color[2]<<15); | ||||||
|  | #endif | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /* draw upper triangle */ | ||||||
|  |     if (eTop_dy) { | ||||||
|  |        mga_fifo(5); | ||||||
|  |        mga_outl(M_AR0, eTop_dy); | ||||||
|  |        if (x3 < x2) { | ||||||
|  |           mga_outl(M_AR1, eTop_dx + eTop_dy - 1); | ||||||
|  |           mga_outl(M_AR2, eTop_dx); | ||||||
|  |           sgn |= M_SDXL; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR1, -eTop_dx); | ||||||
|  |           mga_outl(M_AR2, -eTop_dx); | ||||||
|  |           sgn &= ~M_SDXL; | ||||||
|  |        } | ||||||
|  |        mga_outl(M_SGN, sgn); | ||||||
|  |        mga_outl(M_LEN | M_EXEC, eTop_dy); | ||||||
|  |     } | ||||||
|  |  } else { /* major edge on the left */ | ||||||
|  |     if (eBot_dy) { /* have lower triangle */ | ||||||
|  |        mga_fifo(9 + FIFO_CNT_Z + FIFO_CNT_RGB); | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR0, eMaj_dy); | ||||||
|  |        if (x3 < x1) { | ||||||
|  |           mga_outl(M_AR1, eMaj_dx + eMaj_dy - 1); | ||||||
|  |           mga_outl(M_AR2, eMaj_dx); | ||||||
|  |           sgn |= M_SDXL; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR1, -eMaj_dx); | ||||||
|  |           mga_outl(M_AR2, -eMaj_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR6, eBot_dy); | ||||||
|  |        if (x2 < x1) { | ||||||
|  |           mga_outl(M_AR4, eBot_dx + eBot_dy - 1); | ||||||
|  |           mga_outl(M_AR5, eBot_dx); | ||||||
|  |           sgn |= M_SDXR; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR4, -eBot_dx); | ||||||
|  |           mga_outl(M_AR5, -eBot_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_FXBNDRY, (x1<<16) | x1); | ||||||
|  | #ifdef INTERP_Z | ||||||
|  |        mga_outl(M_DR0, z1<<15); | ||||||
|  | #endif | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  |        mga_outl(M_DR4, v1->color[0]<<15); | ||||||
|  |        mga_outl(M_DR8, v1->color[1]<<15); | ||||||
|  |        mga_outl(M_DR12, v1->color[2]<<15); | ||||||
|  | #endif | ||||||
|  |        mga_outl(M_SGN, sgn); | ||||||
|  |        mga_outl(M_LEN | M_EXEC, eBot_dy); | ||||||
|  |     } else { /* no lower triangle */ | ||||||
|  |        mga_fifo(4 + FIFO_CNT_Z + FIFO_CNT_RGB); | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR0, eMaj_dy); | ||||||
|  |        if (x3 < x1) { | ||||||
|  |           mga_outl(M_AR1, eMaj_dx + eMaj_dy - 1); | ||||||
|  |           mga_outl(M_AR2, eMaj_dx); | ||||||
|  |           sgn |= M_SDXL; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR1, -eMaj_dx); | ||||||
|  |           mga_outl(M_AR2, -eMaj_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_FXBNDRY, (x2<<16) | x1); | ||||||
|  | #ifdef INTERP_Z | ||||||
|  |        mga_outl(M_DR0, z1<<15); | ||||||
|  | #endif | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  |        mga_outl(M_DR4, v1->color[0]<<15); | ||||||
|  |        mga_outl(M_DR8, v1->color[1]<<15); | ||||||
|  |        mga_outl(M_DR12, v1->color[2]<<15); | ||||||
|  | #endif | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /* draw upper triangle */ | ||||||
|  |     if (eTop_dy) { | ||||||
|  |        mga_fifo(5); | ||||||
|  |        mga_outl(M_AR6, eTop_dy); | ||||||
|  |        if (x3 < x2) { | ||||||
|  |           mga_outl(M_AR4, eTop_dx + eTop_dy - 1); | ||||||
|  |           mga_outl(M_AR5, eTop_dx); | ||||||
|  |           sgn |= M_SDXR; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR4, -eTop_dx); | ||||||
|  |           mga_outl(M_AR5, -eTop_dx); | ||||||
|  |           sgn &= ~M_SDXR; | ||||||
|  |        } | ||||||
|  |        mga_outl(M_SGN, sgn); | ||||||
|  |        mga_outl(M_LEN | M_EXEC, eTop_dy); | ||||||
|  |     } | ||||||
|  |  } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #undef FIFO_CNT_RGB | ||||||
|  | #undef FIFO_CNT_Z | ||||||
|  |  | ||||||
|  | #undef TRI_SWAP | ||||||
|  |  | ||||||
|  | #undef SETUP_CODE | ||||||
|  | #undef INTERP_RGB | ||||||
|  | #undef INTERP_Z | ||||||
|  | #undef CULL | ||||||
|  | #undef TAG | ||||||
							
								
								
									
										375
									
								
								src/mesa/drivers/dos/mga/m_ttemp2.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										375
									
								
								src/mesa/drivers/dos/mga/m_ttemp2.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,375 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  5.0 | ||||||
|  |  *  | ||||||
|  |  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | ||||||
|  |  *  | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  *  | ||||||
|  |  * The above copyright notice and this permission notice shall be included | ||||||
|  |  * in all copies or substantial portions of the Software. | ||||||
|  |  *  | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  |  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  |  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP device driver v1.3 for Mesa  --  MGA2064W triangle template | ||||||
|  |  * | ||||||
|  |  *  Copyright (c) 2003 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Triangle Rasterizer Template | ||||||
|  |  * | ||||||
|  |  * This file is #include'd to generate custom triangle rasterizers. | ||||||
|  |  * | ||||||
|  |  * The following macros may be defined to indicate what auxillary information | ||||||
|  |  * must be interplated across the triangle: | ||||||
|  |  *    INTERP_Z        - if defined, interpolate Z values | ||||||
|  |  *    INTERP_RGB      - if defined, interpolate RGB values | ||||||
|  |  * | ||||||
|  |  *    TAG             - function name | ||||||
|  |  *    CULL            - enable culling for: 0=no, 1=back, -1=front | ||||||
|  |  * | ||||||
|  |  *    SETUP_CODE      - to be executed once per triangle (usually HW init) | ||||||
|  |  * | ||||||
|  |  * For flatshaded primitives, the provoking vertex is the final one. | ||||||
|  |  * This code was designed for the origin to be in the upper-left corner. | ||||||
|  |  * | ||||||
|  |  * Inspired by triangle rasterizer code written by Brian Paul. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #define TRI_SWAP(a, b)        \ | ||||||
|  | do {                          \ | ||||||
|  |     const MGAvertex *tmp = a; \ | ||||||
|  |     a = b;                    \ | ||||||
|  |     b = tmp;                  \ | ||||||
|  | } while (0) | ||||||
|  |  | ||||||
|  | void TAG (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v3) | ||||||
|  | { | ||||||
|  |  int area; | ||||||
|  |  int x1, y1, x2, y2, x3, y3; | ||||||
|  |  int eMaj_dx, eMaj_dy, eBot_dx, eBot_dy, eTop_dx, eTop_dy; | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  | #define FIFO_CNT_RGB 3 | ||||||
|  |  int eMaj_dr, eBot_dr, eMaj_dg, eBot_dg, eMaj_db, eBot_db; | ||||||
|  |  int drdx, drdy, dgdx, dgdy, dbdx, dbdy; | ||||||
|  | #else | ||||||
|  | #define FIFO_CNT_RGB 0 | ||||||
|  | #endif | ||||||
|  | #ifdef INTERP_Z | ||||||
|  | #define FIFO_CNT_Z 1 | ||||||
|  |  int dzdx, dzdy; | ||||||
|  |  int eMaj_dz, eBot_dz; | ||||||
|  |  int z1, z2, z3; | ||||||
|  | #else | ||||||
|  | #define FIFO_CNT_Z 0 | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #if defined(INTERP_Z) || defined(INTERP_RGB) | ||||||
|  | #ifndef INTERP_RGB | ||||||
|  |  int red = v3->color[0]; | ||||||
|  |  int green = v3->color[1]; | ||||||
|  |  int blue = v3->color[2]; | ||||||
|  | #endif | ||||||
|  | #else | ||||||
|  |  unsigned long color = mga_mixrgb_full(v3->color); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  int sgn = 0; | ||||||
|  |  | ||||||
|  |  /* sort along the vertical axis */ | ||||||
|  |  if (v2->win[1] < v1->win[1]) { | ||||||
|  |     TRI_SWAP(v1, v2); | ||||||
|  | #ifdef CULL | ||||||
|  |     cull = -cull; | ||||||
|  | #endif | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  if (v3->win[1] < v1->win[1]) { | ||||||
|  |     TRI_SWAP(v1, v3); | ||||||
|  |     TRI_SWAP(v2, v3); | ||||||
|  |  } else if (v3->win[1] < v2->win[1]) { | ||||||
|  |     TRI_SWAP(v2, v3); | ||||||
|  | #ifdef CULL | ||||||
|  |     cull = -cull; | ||||||
|  | #endif     | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  x1 = v1->win[0]; | ||||||
|  |  y1 = v1->win[1]; | ||||||
|  |  x2 = v2->win[0]; | ||||||
|  |  y2 = v2->win[1]; | ||||||
|  |  x3 = v3->win[0]; | ||||||
|  |  y3 = v3->win[1]; | ||||||
|  |  | ||||||
|  |  /* compute deltas for each edge */ | ||||||
|  |  eMaj_dx = x3 - x1; | ||||||
|  |  eMaj_dy = y3 - y1; | ||||||
|  |  eBot_dx = x2 - x1; | ||||||
|  |  eBot_dy = y2 - y1; | ||||||
|  |  eTop_dx = x3 - x2; | ||||||
|  |  eTop_dy = y3 - y2; | ||||||
|  |  | ||||||
|  |  /* compute area */ | ||||||
|  |  if ((area = eMaj_dx * eBot_dy - eBot_dx * eMaj_dy) == 0) { | ||||||
|  |     return; | ||||||
|  |  } | ||||||
|  | #ifdef CULL | ||||||
|  |  if ((area * cull) > 0) { | ||||||
|  |     return; | ||||||
|  |  } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  mga_select(); | ||||||
|  |  | ||||||
|  |  /* set engine state */ | ||||||
|  | #ifdef SETUP_CODE | ||||||
|  |  SETUP_CODE | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  /* draw lower triangle */ | ||||||
|  | #if defined(INTERP_Z) || defined(INTERP_RGB) | ||||||
|  |  mga_fifo(1); | ||||||
|  | #else | ||||||
|  |  mga_fifo(2); | ||||||
|  |  mga_outl(M_FCOL, color); | ||||||
|  | #endif | ||||||
|  |  mga_outl(M_YDST, y1); | ||||||
|  |  | ||||||
|  | #ifdef INTERP_Z | ||||||
|  |  z1 = v1->win[2]; | ||||||
|  |  z2 = v2->win[2]; | ||||||
|  |  z3 = v3->win[2]; | ||||||
|  |  | ||||||
|  |  /* compute d?/dx and d?/dy derivatives */ | ||||||
|  |  eMaj_dz = z3 - z1; | ||||||
|  |  eBot_dz = z2 - z1; | ||||||
|  |  dzdx = ((long long)(eMaj_dz * eBot_dy - eMaj_dy * eBot_dz)<<15) / area; | ||||||
|  |  dzdy = ((long long)(eMaj_dx * eBot_dz - eMaj_dz * eBot_dx)<<15) / area; | ||||||
|  |  | ||||||
|  | #ifndef INTERP_RGB | ||||||
|  |  mga_fifo(11); | ||||||
|  |  mga_outl(M_DR2, dzdx); | ||||||
|  |  mga_outl(M_DR3, dzdy); | ||||||
|  |  mga_outl(M_DR4, red<<15); | ||||||
|  |  mga_outl(M_DR6, 0); | ||||||
|  |  mga_outl(M_DR7, 0); | ||||||
|  |  mga_outl(M_DR8, green<<15); | ||||||
|  |  mga_outl(M_DR10, 0); | ||||||
|  |  mga_outl(M_DR11, 0); | ||||||
|  |  mga_outl(M_DR12, blue<<15); | ||||||
|  |  mga_outl(M_DR14, 0); | ||||||
|  |  mga_outl(M_DR15, 0); | ||||||
|  | #else | ||||||
|  |  mga_fifo(2); | ||||||
|  |  mga_outl(M_DR2, dzdx); | ||||||
|  |  mga_outl(M_DR3, dzdy); | ||||||
|  | #endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  |  /* compute color deltas */ | ||||||
|  |  eMaj_dr = v3->color[0] - v1->color[0]; | ||||||
|  |  eBot_dr = v2->color[0] - v1->color[0]; | ||||||
|  |  eMaj_dg = v3->color[1] - v1->color[1]; | ||||||
|  |  eBot_dg = v2->color[1] - v1->color[1]; | ||||||
|  |  eMaj_db = v3->color[2] - v1->color[2]; | ||||||
|  |  eBot_db = v2->color[2] - v1->color[2]; | ||||||
|  |  | ||||||
|  |  /* compute color increments */ | ||||||
|  |  drdx = ((long long)(eMaj_dr * eBot_dy - eMaj_dy * eBot_dr)<<15) / area; | ||||||
|  |  drdy = ((long long)(eMaj_dx * eBot_dr - eMaj_dr * eBot_dx)<<15) / area; | ||||||
|  |  dgdx = ((long long)(eMaj_dg * eBot_dy - eMaj_dy * eBot_dg)<<15) / area; | ||||||
|  |  dgdy = ((long long)(eMaj_dx * eBot_dg - eMaj_dg * eBot_dx)<<15) / area; | ||||||
|  |  dbdx = ((long long)(eMaj_db * eBot_dy - eMaj_dy * eBot_db)<<15) / area; | ||||||
|  |  dbdy = ((long long)(eMaj_dx * eBot_db - eMaj_db * eBot_dx)<<15) / area; | ||||||
|  |  | ||||||
|  |  mga_fifo(6); | ||||||
|  |  mga_outl(M_DR6, drdx); | ||||||
|  |  mga_outl(M_DR7, drdy); | ||||||
|  |  mga_outl(M_DR10, dgdx); | ||||||
|  |  mga_outl(M_DR11, dgdy); | ||||||
|  |  mga_outl(M_DR14, dbdx); | ||||||
|  |  mga_outl(M_DR15, dbdy); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  if (area > 0) { /* major edge on the right */ | ||||||
|  |     if (eBot_dy) { /* have lower triangle */ | ||||||
|  |        mga_fifo(9 + FIFO_CNT_Z + FIFO_CNT_RGB); | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR0, eBot_dy); | ||||||
|  |        if (x2 < x1) { | ||||||
|  |           mga_outl(M_AR1, eBot_dx + eBot_dy - 1); | ||||||
|  |           mga_outl(M_AR2, eBot_dx); | ||||||
|  |           sgn |= M_SDXL; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR1, -eBot_dx); | ||||||
|  |           mga_outl(M_AR2, -eBot_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR6, eMaj_dy); | ||||||
|  |        if (x3 < x1) { | ||||||
|  |           mga_outl(M_AR4, eMaj_dx + eMaj_dy - 1); | ||||||
|  |           mga_outl(M_AR5, eMaj_dx); | ||||||
|  |           sgn |= M_SDXR; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR4, -eMaj_dx); | ||||||
|  |           mga_outl(M_AR5, -eMaj_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_FXBNDRY, (x1<<16) | x1); | ||||||
|  | #ifdef INTERP_Z | ||||||
|  |        mga_outl(M_DR0, z1<<15); | ||||||
|  | #endif | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  |        mga_outl(M_DR4, v1->color[0]<<15); | ||||||
|  |        mga_outl(M_DR8, v1->color[1]<<15); | ||||||
|  |        mga_outl(M_DR12, v1->color[2]<<15); | ||||||
|  | #endif | ||||||
|  |        mga_outl(M_SGN, sgn); | ||||||
|  |        mga_outl(M_LEN | M_EXEC, eBot_dy); | ||||||
|  |     } else { /* no lower triangle */ | ||||||
|  |        mga_fifo(4 + FIFO_CNT_Z + FIFO_CNT_RGB); | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR6, eMaj_dy); | ||||||
|  |        if (x3 < x1) { | ||||||
|  |           mga_outl(M_AR4, eMaj_dx + eMaj_dy - 1); | ||||||
|  |           mga_outl(M_AR5, eMaj_dx); | ||||||
|  |           sgn |= M_SDXR; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR4, -eMaj_dx); | ||||||
|  |           mga_outl(M_AR5, -eMaj_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_FXBNDRY, (x1<<16) | x2); | ||||||
|  | #ifdef INTERP_Z | ||||||
|  |        mga_outl(M_DR0, z2<<15); | ||||||
|  | #endif | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  |        mga_outl(M_DR4, v2->color[0]<<15); | ||||||
|  |        mga_outl(M_DR8, v2->color[1]<<15); | ||||||
|  |        mga_outl(M_DR12, v2->color[2]<<15); | ||||||
|  | #endif | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /* draw upper triangle */ | ||||||
|  |     if (eTop_dy) { | ||||||
|  |        mga_fifo(5); | ||||||
|  |        mga_outl(M_AR0, eTop_dy); | ||||||
|  |        if (x3 < x2) { | ||||||
|  |           mga_outl(M_AR1, eTop_dx + eTop_dy - 1); | ||||||
|  |           mga_outl(M_AR2, eTop_dx); | ||||||
|  |           sgn |= M_SDXL; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR1, -eTop_dx); | ||||||
|  |           mga_outl(M_AR2, -eTop_dx); | ||||||
|  |           sgn &= ~M_SDXL; | ||||||
|  |        } | ||||||
|  |        mga_outl(M_SGN, sgn); | ||||||
|  |        mga_outl(M_LEN | M_EXEC, eTop_dy); | ||||||
|  |     } | ||||||
|  |  } else { /* major edge on the left */ | ||||||
|  |     if (eBot_dy) { /* have lower triangle */ | ||||||
|  |        mga_fifo(9 + FIFO_CNT_Z + FIFO_CNT_RGB); | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR0, eMaj_dy); | ||||||
|  |        if (x3 < x1) { | ||||||
|  |           mga_outl(M_AR1, eMaj_dx + eMaj_dy - 1); | ||||||
|  |           mga_outl(M_AR2, eMaj_dx); | ||||||
|  |           sgn |= M_SDXL; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR1, -eMaj_dx); | ||||||
|  |           mga_outl(M_AR2, -eMaj_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR6, eBot_dy); | ||||||
|  |        if (x2 < x1) { | ||||||
|  |           mga_outl(M_AR4, eBot_dx + eBot_dy - 1); | ||||||
|  |           mga_outl(M_AR5, eBot_dx); | ||||||
|  |           sgn |= M_SDXR; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR4, -eBot_dx); | ||||||
|  |           mga_outl(M_AR5, -eBot_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_FXBNDRY, (x1<<16) | x1); | ||||||
|  | #ifdef INTERP_Z | ||||||
|  |        mga_outl(M_DR0, z1<<15); | ||||||
|  | #endif | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  |        mga_outl(M_DR4, v1->color[0]<<15); | ||||||
|  |        mga_outl(M_DR8, v1->color[1]<<15); | ||||||
|  |        mga_outl(M_DR12, v1->color[2]<<15); | ||||||
|  | #endif | ||||||
|  |        mga_outl(M_SGN, sgn); | ||||||
|  |        mga_outl(M_LEN | M_EXEC, eBot_dy); | ||||||
|  |     } else { /* no lower triangle */ | ||||||
|  |        mga_fifo(4 + FIFO_CNT_Z + FIFO_CNT_RGB); | ||||||
|  |  | ||||||
|  |        mga_outl(M_AR0, eMaj_dy); | ||||||
|  |        if (x3 < x1) { | ||||||
|  |           mga_outl(M_AR1, eMaj_dx + eMaj_dy - 1); | ||||||
|  |           mga_outl(M_AR2, eMaj_dx); | ||||||
|  |           sgn |= M_SDXL; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR1, -eMaj_dx); | ||||||
|  |           mga_outl(M_AR2, -eMaj_dx); | ||||||
|  |        } | ||||||
|  |  | ||||||
|  |        mga_outl(M_FXBNDRY, (x2<<16) | x1); | ||||||
|  | #ifdef INTERP_Z | ||||||
|  |        mga_outl(M_DR0, z1<<15); | ||||||
|  | #endif | ||||||
|  | #ifdef INTERP_RGB | ||||||
|  |        mga_outl(M_DR4, v1->color[0]<<15); | ||||||
|  |        mga_outl(M_DR8, v1->color[1]<<15); | ||||||
|  |        mga_outl(M_DR12, v1->color[2]<<15); | ||||||
|  | #endif | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /* draw upper triangle */ | ||||||
|  |     if (eTop_dy) { | ||||||
|  |        mga_fifo(5); | ||||||
|  |        mga_outl(M_AR6, eTop_dy); | ||||||
|  |        if (x3 < x2) { | ||||||
|  |           mga_outl(M_AR4, eTop_dx + eTop_dy - 1); | ||||||
|  |           mga_outl(M_AR5, eTop_dx); | ||||||
|  |           sgn |= M_SDXR; | ||||||
|  |        } else { | ||||||
|  |           mga_outl(M_AR4, -eTop_dx); | ||||||
|  |           mga_outl(M_AR5, -eTop_dx); | ||||||
|  |           sgn &= ~M_SDXR; | ||||||
|  |        } | ||||||
|  |        mga_outl(M_SGN, sgn); | ||||||
|  |        mga_outl(M_LEN | M_EXEC, eTop_dy); | ||||||
|  |     } | ||||||
|  |  } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #undef FIFO_CNT_RGB | ||||||
|  | #undef FIFO_CNT_Z | ||||||
|  |  | ||||||
|  | #undef TRI_SWAP | ||||||
|  |  | ||||||
|  | #undef SETUP_CODE | ||||||
|  | #undef INTERP_RGB | ||||||
|  | #undef INTERP_Z | ||||||
|  | #undef CULL | ||||||
|  | #undef TAG | ||||||
							
								
								
									
										1536
									
								
								src/mesa/drivers/dos/mga/mga.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1536
									
								
								src/mesa/drivers/dos/mga/mga.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										91
									
								
								src/mesa/drivers/dos/mga/mga.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								src/mesa/drivers/dos/mga/mga.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,91 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  5.0 | ||||||
|  |  *  | ||||||
|  |  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | ||||||
|  |  *  | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  *  | ||||||
|  |  * The above copyright notice and this permission notice shall be included | ||||||
|  |  * in all copies or substantial portions of the Software. | ||||||
|  |  *  | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  |  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  |  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP device driver v1.3 for Mesa  --  MGA2064W | ||||||
|  |  * | ||||||
|  |  *  Copyright (c) 2003 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifndef MGA_H_included | ||||||
|  | #define MGA_H_included | ||||||
|  |  | ||||||
|  | #define MGA_GET_CARD_NAME   0x0100 | ||||||
|  | #define MGA_GET_VRAM        0x0101 | ||||||
|  | #define MGA_GET_CI_PREC     0x0200 | ||||||
|  | #define MGA_GET_HPIXELS     0x0201 | ||||||
|  | #define MGA_GET_SCREEN_SIZE 0x0202 | ||||||
|  |  | ||||||
|  | int mga_open (int width, int height, int bpp, int buffers, int zbuffer, int refresh); | ||||||
|  | void mga_clear (int front, int back, int zed, int left, int top, int width, int height, int color, unsigned short z); | ||||||
|  | int mga_get (int pname, int *params); | ||||||
|  | void mga_close (int restore, int unmap); | ||||||
|  |  | ||||||
|  | extern void (*mga_putpixel) (unsigned int offset, int color); | ||||||
|  | extern int (*mga_getpixel) (unsigned int offset); | ||||||
|  | extern void (*mga_getrgba) (unsigned int offset, unsigned char rgba[4]); | ||||||
|  | extern int (*mga_mixrgb) (const unsigned char rgb[]); | ||||||
|  |  | ||||||
|  | #define MGA_BACKBUFFER !0 | ||||||
|  | #define MGA_FRONTBUFFER 0 | ||||||
|  | void mga_set_readbuffer (int buffer); | ||||||
|  | void mga_set_writebuffer (int buffer); | ||||||
|  | void mga_swapbuffers (int swapinterval); | ||||||
|  |  | ||||||
|  | unsigned short mga_getz (int offset); | ||||||
|  | void mga_setz (int offset, unsigned short z); | ||||||
|  |  | ||||||
|  | void mga_wait_idle (void); | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * vertex structure, used for primitive rendering | ||||||
|  |  */ | ||||||
|  | typedef struct { | ||||||
|  |         int win[4];             /* X, Y, Z, ? */ | ||||||
|  |         unsigned char color[4]; /* R, G, B, A */ | ||||||
|  | } MGAvertex; | ||||||
|  |  | ||||||
|  | void mga_draw_line_rgb_flat (const MGAvertex *v1, const MGAvertex *v2); | ||||||
|  | void mga_draw_line_rgb_flat_zless (const MGAvertex *v1, const MGAvertex *v2); | ||||||
|  | void mga_draw_line_rgb_iter (const MGAvertex *v1, const MGAvertex *v2); | ||||||
|  | void mga_draw_line_rgb_iter_zless (const MGAvertex *v1, const MGAvertex *v2); | ||||||
|  |  | ||||||
|  | void mga_draw_tri_rgb_flat (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v3); | ||||||
|  | void mga_draw_tri_rgb_flat_zless (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v3); | ||||||
|  | void mga_draw_tri_rgb_iter (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v3); | ||||||
|  | void mga_draw_tri_rgb_iter_zless (int cull, const MGAvertex *v1, const MGAvertex *v2, const MGAvertex *v3); | ||||||
|  |  | ||||||
|  | void mga_draw_rect_rgb_flat (int left, int top, int width, int height, int color); | ||||||
|  | void mga_draw_rect_rgb_tx32 (int left, int top, int width, int height, const unsigned long *bitmap); | ||||||
|  | void mga_draw_rect_rgb_tx24 (int left, int top, int width, int height, const unsigned long *bitmap); | ||||||
|  | void mga_draw_span_rgb_tx32 (int left, int top, int width, const unsigned long *bitmap); | ||||||
|  | void mga_draw_span_rgb_tx24 (int left, int top, int width, const unsigned long *bitmap); | ||||||
|  |  | ||||||
|  | void mga_iload_32RGB (int left, int top, int width, int height, const unsigned long *bitmap); | ||||||
|  | void mga_iload_24RGB (int left, int top, int width, int height, const unsigned long *bitmap); | ||||||
|  |  | ||||||
|  | #endif | ||||||
							
								
								
									
										416
									
								
								src/mesa/drivers/dos/mga/mga_hw.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										416
									
								
								src/mesa/drivers/dos/mga/mga_hw.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,416 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  5.0 | ||||||
|  |  *  | ||||||
|  |  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | ||||||
|  |  *  | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  *  | ||||||
|  |  * The above copyright notice and this permission notice shall be included | ||||||
|  |  * in all copies or substantial portions of the Software. | ||||||
|  |  *  | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  |  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  |  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP device driver v1.3 for Mesa  --  MGA2064W HW mapping | ||||||
|  |  * | ||||||
|  |  *  Copyright (c) 2003 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #include <crt0.h> | ||||||
|  | #include <dpmi.h> | ||||||
|  | #include <pc.h> | ||||||
|  | #include <string.h> | ||||||
|  | #include <sys/nearptr.h> | ||||||
|  | #include <sys/segments.h> | ||||||
|  |  | ||||||
|  | #include "../internal.h" | ||||||
|  | #include "mga_reg.h" | ||||||
|  | #include "mga_hw.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Hack alert: | ||||||
|  |  * these should really be externs | ||||||
|  |  */ | ||||||
|  | /* PCI access routines */ | ||||||
|  | static int pci_find_device (int deviceID, int vendorID, int deviceIndex, int *handle); | ||||||
|  | static unsigned long pci_read_long (int handle, int index); | ||||||
|  | static void pci_write_long (int handle, int index, unsigned long value); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* PCI device identifiers */ | ||||||
|  | #define MATROX_VENDOR_ID 0x102B | ||||||
|  |  | ||||||
|  | typedef enum { | ||||||
|  |         MATROX_MILL_ID = 0x0519 | ||||||
|  | } MATROX_ID; | ||||||
|  |  | ||||||
|  | static MATROX_ID matrox_id_list[] = { | ||||||
|  |        MATROX_MILL_ID, | ||||||
|  |        0 | ||||||
|  | }; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* internal hardware data structures */ | ||||||
|  | #if !MGA_FARPTR | ||||||
|  | static int dirty; | ||||||
|  | #endif | ||||||
|  | static int bus_id; | ||||||
|  | static unsigned long reg40; | ||||||
|  | static unsigned long io_mem_base[4], linear_base; | ||||||
|  | static unsigned long io_mem_size[4], linear_size; | ||||||
|  | static MATROX_ID matrox_id; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* interface structures containing hardware pointer data */ | ||||||
|  | MGA_HWPTR mgaptr; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: create MMAP | ||||||
|  |  * | ||||||
|  |  * In  : | ||||||
|  |  * Out : | ||||||
|  |  * | ||||||
|  |  * Note: | ||||||
|  |  */ | ||||||
|  | static int _create_mmap (__dpmi_paddr *m, unsigned long base, unsigned long size) | ||||||
|  | { | ||||||
|  | #if MGA_FARPTR | ||||||
|  |  int sel; | ||||||
|  |  if (_create_selector(&sel, base, size)) { | ||||||
|  |     return -1; | ||||||
|  |  } | ||||||
|  |  m->selector = sel; | ||||||
|  |  m->offset32 = 0; | ||||||
|  | #else | ||||||
|  |  m->selector = _my_ds(); | ||||||
|  |  if (_create_linear_mapping(&m->offset32, base, size)) { | ||||||
|  |     return -1; | ||||||
|  |  } | ||||||
|  |  m->offset32 -= __djgpp_base_address; | ||||||
|  | #endif | ||||||
|  |  return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: destroy MMAP | ||||||
|  |  * | ||||||
|  |  * In  : | ||||||
|  |  * Out : | ||||||
|  |  * | ||||||
|  |  * Note: | ||||||
|  |  */ | ||||||
|  | static void _destroy_mmap (__dpmi_paddr *m) | ||||||
|  | { | ||||||
|  | #if MGA_FARPTR | ||||||
|  |  int sel = m->selector; | ||||||
|  |  _remove_selector(&sel); | ||||||
|  | #else | ||||||
|  |  m->offset32 += __djgpp_base_address; | ||||||
|  |  _remove_linear_mapping(&m->offset32); | ||||||
|  | #endif | ||||||
|  |  m->selector = 0; | ||||||
|  |  m->offset32 = 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: Counts amount of installed RAM | ||||||
|  |  * | ||||||
|  |  * In  : | ||||||
|  |  * Out : | ||||||
|  |  * | ||||||
|  |  * Note: | ||||||
|  |  */ | ||||||
|  | static int _mga_get_vram (MATROX_ID chip, unsigned long base) | ||||||
|  | { | ||||||
|  |  int ProbeSize = 8; | ||||||
|  |  int SizeFound = 2; | ||||||
|  |  unsigned char tmp; | ||||||
|  |  int i; | ||||||
|  |  __dpmi_paddr fb; | ||||||
|  |  | ||||||
|  |  switch (chip) { | ||||||
|  | 	case MATROX_MILL_ID: | ||||||
|  | 	     ProbeSize = 8; | ||||||
|  | 	     break; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  if (_create_mmap(&fb, base, ProbeSize*1024*1024)) { | ||||||
|  |     return 0; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  /* turn MGA mode on - enable linear frame buffer (CRTCEXT3) */ | ||||||
|  |  mga_select(); | ||||||
|  |  mga_outb(M_CRTC_EXT_INDEX, 3); | ||||||
|  |  tmp = mga_inb(M_CRTC_EXT_DATA); | ||||||
|  |  mga_outb(M_CRTC_EXT_DATA, tmp | M_MGAMODE); | ||||||
|  |  | ||||||
|  |  /* write, read and compare method */ | ||||||
|  |  for (i=ProbeSize; i>2; i-= 2) { | ||||||
|  |      hwptr_pokeb(fb, i*1024*1024 - 1, 0xAA); | ||||||
|  |      mga_select(); | ||||||
|  |      mga_outb(M_CRTC_INDEX, 0); /* flush the cache */ | ||||||
|  |      mga_inl(M_STATUS); /* delay */ | ||||||
|  |      mga_inl(M_STATUS); /* delay */ | ||||||
|  |      mga_inl(M_STATUS); /* delay */ | ||||||
|  |      if (hwptr_peekb(fb, i*1024*1024 - 1) == 0xAA) { | ||||||
|  | 	SizeFound = i; | ||||||
|  | 	break; | ||||||
|  |      } | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  /* restore CRTCEXT3 state */ | ||||||
|  |  mga_select(); | ||||||
|  |  mga_outb(M_CRTC_EXT_INDEX, 3); | ||||||
|  |  mga_outb(M_CRTC_EXT_DATA, tmp); | ||||||
|  |  | ||||||
|  |  _destroy_mmap(&fb); | ||||||
|  |  | ||||||
|  |  return SizeFound*1024*1024; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: Frees all resources allocated by MGA init code. | ||||||
|  |  * | ||||||
|  |  * In  : | ||||||
|  |  * Out : | ||||||
|  |  * | ||||||
|  |  * Note: | ||||||
|  |  */ | ||||||
|  | void mga_hw_fini (void) | ||||||
|  | { | ||||||
|  |  int i; | ||||||
|  |  | ||||||
|  |  pci_write_long(bus_id, 0x40, reg40); | ||||||
|  |  | ||||||
|  |  for (i=0; i<4; i++) { | ||||||
|  |      _destroy_mmap(&mgaptr.io_mem_map[i]); | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  _destroy_mmap(&mgaptr.linear_map); | ||||||
|  |  | ||||||
|  | #if !MGA_FARPTR | ||||||
|  |  if (dirty) { | ||||||
|  |     __djgpp_nearptr_disable(); | ||||||
|  |     dirty = FALSE; | ||||||
|  |  } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  matrox_id = 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: Attempts to detect MGA. | ||||||
|  |  * | ||||||
|  |  * In  : | ||||||
|  |  * Out : | ||||||
|  |  * | ||||||
|  |  * Note: The first thing ever to be called. This is in charge of filling in | ||||||
|  |  *       the driver header with all the required information and function | ||||||
|  |  *       pointers. We do not yet have access to the video memory, so we can't | ||||||
|  |  *       talk directly to the card. | ||||||
|  |  */ | ||||||
|  | int mga_hw_init (unsigned long *vram, int *interleave, char *name) | ||||||
|  | { | ||||||
|  |  int i; | ||||||
|  |  unsigned long pci_base[2]; | ||||||
|  |  | ||||||
|  |  if (matrox_id) { | ||||||
|  |     return matrox_id; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  | #if !MGA_FARPTR | ||||||
|  |  /* enable nearptr access */ | ||||||
|  |  if (_crt0_startup_flags & _CRT0_FLAG_NEARPTR) { | ||||||
|  |     dirty = FALSE; | ||||||
|  |  } else { | ||||||
|  |     if (__djgpp_nearptr_enable() == 0) | ||||||
|  |        return NULL; | ||||||
|  |  | ||||||
|  |     dirty = TRUE; | ||||||
|  |  } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  /* find PCI device */ | ||||||
|  |  matrox_id = 0; | ||||||
|  |  | ||||||
|  |  for (bus_id=0, i=0; matrox_id_list[i]; i++) { | ||||||
|  |      if (pci_find_device(matrox_id_list[i], MATROX_VENDOR_ID, 0, &bus_id)) { | ||||||
|  | 	matrox_id = matrox_id_list[i]; | ||||||
|  | 	break; | ||||||
|  |      } | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  /* set up the card name */ | ||||||
|  |  switch (matrox_id) { | ||||||
|  | 	case MATROX_MILL_ID: | ||||||
|  | 	     if (name) strcpy(name, "Millennium"); | ||||||
|  | 	     break; | ||||||
|  |         default: | ||||||
|  |              matrox_id = 0; | ||||||
|  |              return -1; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  reg40 = pci_read_long(bus_id, 0x40); | ||||||
|  | #if 0 /* overclock a little :) */ | ||||||
|  |  { | ||||||
|  |   int rfhcnt = (reg40 >> 16) & 0xF; | ||||||
|  |   if ((reg40 & 0x200000) && (rfhcnt < 0xC)) { | ||||||
|  |      pci_write_long(bus_id, 0x40, (reg40 & 0xFFF0FFFF) | 0x000C0000); | ||||||
|  |   } | ||||||
|  |  } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  /* read hardware configuration data */ | ||||||
|  |  for (i=0; i<2; i++) | ||||||
|  |      pci_base[i] = pci_read_long(bus_id, 16+i*4); | ||||||
|  |  | ||||||
|  |  /* work out the linear framebuffer and MMIO addresses */ | ||||||
|  |  if (matrox_id == MATROX_MILL_ID) { | ||||||
|  |     if (pci_base[0]) | ||||||
|  |        io_mem_base[0] = pci_base[0] & 0xFFFFC000; | ||||||
|  |  | ||||||
|  |     if (pci_base[1]) | ||||||
|  |        linear_base = pci_base[1] & 0xFF800000; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  if (!linear_base || !io_mem_base[0]) | ||||||
|  |     return NULL; | ||||||
|  |  | ||||||
|  |  /* deal with the memory mapping crap */ | ||||||
|  |  io_mem_size[0] = 0x4000; | ||||||
|  |  | ||||||
|  |  for (i=0; i<4; i++) { | ||||||
|  |      if (io_mem_base[i]) { | ||||||
|  |         if (_create_mmap(&mgaptr.io_mem_map[i], io_mem_base[i], io_mem_size[i])) { | ||||||
|  | 	   mga_hw_fini(); | ||||||
|  | 	   return NULL; | ||||||
|  | 	} | ||||||
|  |      } | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  *vram = linear_size = _mga_get_vram(matrox_id, linear_base); | ||||||
|  |  | ||||||
|  |  if (_create_mmap(&mgaptr.linear_map, linear_base, linear_size)) { | ||||||
|  |     mga_hw_fini(); | ||||||
|  |     return NULL; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  /* fill in user data */ | ||||||
|  |  *interleave = linear_size > 2*1024*1024; | ||||||
|  |  | ||||||
|  |  return matrox_id; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* PCI routines added by SET */ | ||||||
|  | #define PCIAddr   0xCF8 | ||||||
|  | #define PCIData   0xCFC | ||||||
|  | #define PCIEnable 0x80000000 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* FindPCIDevice: | ||||||
|  |  *  Replacement for the INT 1A - PCI BIOS v2.0c+ - FIND PCI DEVICE, AX = B102h | ||||||
|  |  * | ||||||
|  |  *  Note: deviceIndex is because a card can hold more than one PCI chip. | ||||||
|  |  *  | ||||||
|  |  *  Searches the board of the vendor supplied in vendorID with  | ||||||
|  |  *  identification number deviceID and index deviceIndex (normally 0).  | ||||||
|  |  *  The value returned in handle can be used to access the PCI registers  | ||||||
|  |  *  of this board. | ||||||
|  |  * | ||||||
|  |  *  Return: 1 if found 0 if not found. | ||||||
|  |  */ | ||||||
|  | static int pci_find_device (int deviceID, int vendorID, int deviceIndex, int *handle) | ||||||
|  | { | ||||||
|  |  int model, vendor, card, device; | ||||||
|  |  unsigned value, full_id, bus, busMax; | ||||||
|  |  | ||||||
|  |  deviceIndex <<= 8; | ||||||
|  |  | ||||||
|  |  /* for each PCI bus */ | ||||||
|  |  for (bus=0, busMax=0x10000; bus<busMax; bus+=0x10000) { | ||||||
|  |  | ||||||
|  |      /* for each hardware device */ | ||||||
|  |      for (device=0, card=0; card<32; card++, device+=0x800) { | ||||||
|  | 	 value = PCIEnable | bus | deviceIndex | device; | ||||||
|  | 	 outportl(PCIAddr, value); | ||||||
|  | 	 full_id = inportl(PCIData); | ||||||
|  |  | ||||||
|  | 	 /* get the vendor and model ID */ | ||||||
|  | 	 vendor = full_id & 0xFFFF; | ||||||
|  | 	 model = full_id >> 16; | ||||||
|  |  | ||||||
|  | 	 if (vendor != 0xFFFF) { | ||||||
|  | 	    /* is this the one we want? */ | ||||||
|  | 	    if ((deviceID == model) && (vendorID == vendor)) { | ||||||
|  | 	       *handle = value; | ||||||
|  | 	       return 1; | ||||||
|  | 	    } | ||||||
|  |  | ||||||
|  | 	    /* is it a bridge to a secondary bus? */ | ||||||
|  | 	    outportl(PCIAddr, value | 8); | ||||||
|  |  | ||||||
|  | 	    if (((inportl(PCIData) >> 16) == 0x0600) || (full_id==0x00011011)) | ||||||
|  | 	       busMax += 0x10000; | ||||||
|  |          } | ||||||
|  |      } | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: | ||||||
|  |  * | ||||||
|  |  * In  : | ||||||
|  |  * Out : | ||||||
|  |  * | ||||||
|  |  * Note: | ||||||
|  |  */ | ||||||
|  | static unsigned long pci_read_long (int handle, int index) | ||||||
|  | { | ||||||
|  |  outportl(PCIAddr, PCIEnable | handle | index); | ||||||
|  |  return inportl(PCIData); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: | ||||||
|  |  * | ||||||
|  |  * In  : | ||||||
|  |  * Out : | ||||||
|  |  * | ||||||
|  |  * Note: | ||||||
|  |  */ | ||||||
|  | static void pci_write_long (int handle, int index, unsigned long value) | ||||||
|  | { | ||||||
|  |  outportl(PCIAddr, PCIEnable | handle | index); | ||||||
|  |  outportl(PCIData, value); | ||||||
|  | } | ||||||
							
								
								
									
										113
									
								
								src/mesa/drivers/dos/mga/mga_hw.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								src/mesa/drivers/dos/mga/mga_hw.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,113 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  5.0 | ||||||
|  |  *  | ||||||
|  |  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | ||||||
|  |  *  | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  *  | ||||||
|  |  * The above copyright notice and this permission notice shall be included | ||||||
|  |  * in all copies or substantial portions of the Software. | ||||||
|  |  *  | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  |  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  |  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP device driver v1.3 for Mesa  --  MGA2064W HW mapping | ||||||
|  |  * | ||||||
|  |  *  Copyright (c) 2003 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifndef MGA_HW_included | ||||||
|  | #define MGA_HW_included | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* set this to zero to use near pointers */ | ||||||
|  | #define MGA_FARPTR 1 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* access macros */ | ||||||
|  | #if MGA_FARPTR | ||||||
|  |  | ||||||
|  | #include <sys/farptr.h> | ||||||
|  |  | ||||||
|  | #define hwptr_pokeb(ptr, off, val)     _farpokeb((ptr).selector, (ptr).offset32+(off), (val)) | ||||||
|  | #define hwptr_pokew(ptr, off, val)     _farpokew((ptr).selector, (ptr).offset32+(off), (val)) | ||||||
|  | #define hwptr_pokel(ptr, off, val)     _farpokel((ptr).selector, (ptr).offset32+(off), (val)) | ||||||
|  |  | ||||||
|  | #define hwptr_peekb(ptr, off)          _farpeekb((ptr).selector, (ptr).offset32+(off)) | ||||||
|  | #define hwptr_peekw(ptr, off)          _farpeekw((ptr).selector, (ptr).offset32+(off)) | ||||||
|  | #define hwptr_peekl(ptr, off)          _farpeekl((ptr).selector, (ptr).offset32+(off)) | ||||||
|  |  | ||||||
|  | #define hwptr_select(ptr)              _farsetsel((ptr).selector) | ||||||
|  | #define hwptr_unselect(ptr)            (ptr).selector = _fargetsel() | ||||||
|  |  | ||||||
|  | #define hwptr_nspokeb(ptr, off, val)   _farnspokeb((ptr).offset32+(off), (val)) | ||||||
|  | #define hwptr_nspokew(ptr, off, val)   _farnspokew((ptr).offset32+(off), (val)) | ||||||
|  | #define hwptr_nspokel(ptr, off, val)   _farnspokel((ptr).offset32+(off), (val)) | ||||||
|  |  | ||||||
|  | #define hwptr_nspeekb(ptr, off)        _farnspeekb((ptr).offset32+(off)) | ||||||
|  | #define hwptr_nspeekw(ptr, off)        _farnspeekw((ptr).offset32+(off)) | ||||||
|  | #define hwptr_nspeekl(ptr, off)        _farnspeekl((ptr).offset32+(off)) | ||||||
|  |  | ||||||
|  | #else | ||||||
|  |  | ||||||
|  | #define hwptr_pokeb(ptr, off, val)     *((volatile unsigned char *)((ptr).offset32+(off))) = (val) | ||||||
|  | #define hwptr_pokew(ptr, off, val)     *((volatile unsigned short *)((ptr).offset32+(off))) = (val) | ||||||
|  | #define hwptr_pokel(ptr, off, val)     *((volatile unsigned long *)((ptr).offset32+(off))) = (val) | ||||||
|  |  | ||||||
|  | #define hwptr_peekb(ptr, off)          (*((volatile unsigned char *)((ptr).offset32+(off)))) | ||||||
|  | #define hwptr_peekw(ptr, off)          (*((volatile unsigned short *)((ptr).offset32+(off)))) | ||||||
|  | #define hwptr_peekl(ptr, off)          (*((volatile unsigned long *)((ptr).offset32+(off)))) | ||||||
|  |  | ||||||
|  | #define hwptr_select(ptr) | ||||||
|  | #define hwptr_unselect(ptr) | ||||||
|  |  | ||||||
|  | #define hwptr_nspokeb(ptr, off, val)   *((volatile unsigned char *)((ptr).offset32+(off))) = (val) | ||||||
|  | #define hwptr_nspokew(ptr, off, val)   *((volatile unsigned short *)((ptr).offset32+(off))) = (val) | ||||||
|  | #define hwptr_nspokel(ptr, off, val)   *((volatile unsigned long *)((ptr).offset32+(off))) = (val) | ||||||
|  |  | ||||||
|  | #define hwptr_nspeekb(ptr, off)        (*((volatile unsigned char *)((ptr).offset32+(off)))) | ||||||
|  | #define hwptr_nspeekw(ptr, off)        (*((volatile unsigned short *)((ptr).offset32+(off)))) | ||||||
|  | #define hwptr_nspeekl(ptr, off)        (*((volatile unsigned long *)((ptr).offset32+(off)))) | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* helpers for accessing the Matrox registers */ | ||||||
|  | #define mga_select()          hwptr_select(mgaptr.io_mem_map[0]) | ||||||
|  | #define mga_inb(addr)         hwptr_nspeekb(mgaptr.io_mem_map[0], addr) | ||||||
|  | #define mga_inw(addr)         hwptr_nspeekw(mgaptr.io_mem_map[0], addr) | ||||||
|  | #define mga_inl(addr)         hwptr_nspeekl(mgaptr.io_mem_map[0], addr) | ||||||
|  | #define mga_outb(addr, val)   hwptr_nspokeb(mgaptr.io_mem_map[0], addr, val) | ||||||
|  | #define mga_outw(addr, val)   hwptr_nspokew(mgaptr.io_mem_map[0], addr, val) | ||||||
|  | #define mga_outl(addr, val)   hwptr_nspokel(mgaptr.io_mem_map[0], addr, val) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | typedef struct MGA_HWPTR { | ||||||
|  |         __dpmi_paddr io_mem_map[4], linear_map; | ||||||
|  | } MGA_HWPTR; | ||||||
|  |  | ||||||
|  | extern MGA_HWPTR mgaptr; | ||||||
|  |  | ||||||
|  | void mga_hw_fini (void); | ||||||
|  | int mga_hw_init (unsigned long *vram, int *interleave, char *name); | ||||||
|  |  | ||||||
|  | #endif | ||||||
							
								
								
									
										231
									
								
								src/mesa/drivers/dos/mga/mga_mode.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										231
									
								
								src/mesa/drivers/dos/mga/mga_mode.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,231 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  5.0 | ||||||
|  |  *  | ||||||
|  |  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | ||||||
|  |  *  | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  *  | ||||||
|  |  * The above copyright notice and this permission notice shall be included | ||||||
|  |  * in all copies or substantial portions of the Software. | ||||||
|  |  *  | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  |  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  |  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP device driver v1.3 for Mesa  --  MGA2064W mode switching | ||||||
|  |  * | ||||||
|  |  *  Copyright (c) 2003 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #include <dpmi.h> | ||||||
|  | #include <string.h> | ||||||
|  | #include <stubinfo.h> | ||||||
|  | #include <sys/exceptn.h> | ||||||
|  | #include <sys/farptr.h> | ||||||
|  | #include <sys/movedata.h> | ||||||
|  | #include <sys/segments.h> | ||||||
|  |  | ||||||
|  | #include "../internal.h" | ||||||
|  | #include "mga_mode.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | static MGA_MODE oldmode; | ||||||
|  | static MGA_MODE modes[64]; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * VESA info | ||||||
|  |  */ | ||||||
|  | #define V_SIGN     0 | ||||||
|  | #define V_MINOR    4 | ||||||
|  | #define V_MAJOR    5 | ||||||
|  | #define V_OEM_OFS  6 | ||||||
|  | #define V_OEM_SEG  8 | ||||||
|  | #define V_MODE_OFS 14 | ||||||
|  | #define V_MODE_SEG 16 | ||||||
|  | #define V_MEMORY   18 | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * mode info | ||||||
|  |  */ | ||||||
|  | #define M_ATTR     0 | ||||||
|  | #define M_GRAN     4 | ||||||
|  | #define M_SCANLEN  16 | ||||||
|  | #define M_XRES     18 | ||||||
|  | #define M_YRES     20 | ||||||
|  | #define M_BPP      25 | ||||||
|  | #define M_RED      31 | ||||||
|  | #define M_GREEN    33 | ||||||
|  | #define M_BLUE     35 | ||||||
|  | #define M_PHYS_PTR 40 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: get available modes | ||||||
|  |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : linear modes list ptr | ||||||
|  |  * | ||||||
|  |  * Note: shouldn't use VESA... | ||||||
|  |  */ | ||||||
|  | static MGA_MODE *_mga_mode_check (void) | ||||||
|  | { | ||||||
|  |  __dpmi_regs r; | ||||||
|  |  word16 *p; | ||||||
|  |  MGA_MODE *q; | ||||||
|  |  char vesa_info[512], tmp[512]; | ||||||
|  |  | ||||||
|  |  _farpokel(_stubinfo->ds_selector, 0, 0x32454256); | ||||||
|  |  r.x.ax = 0x4f00; | ||||||
|  |  r.x.di = 0; | ||||||
|  |  r.x.es = _stubinfo->ds_segment; | ||||||
|  |  __dpmi_int(0x10, &r); | ||||||
|  |  movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512); | ||||||
|  |  if ((r.x.ax!=0x004f) || ((_32_ vesa_info[V_SIGN])!=0x41534556)) { | ||||||
|  |     return NULL; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  p = (word16 *)(((_16_ vesa_info[V_MODE_SEG])<<4) + (_16_ vesa_info[V_MODE_OFS])); | ||||||
|  |  q = modes; | ||||||
|  |  do { | ||||||
|  |      if ((q->mode=_farpeekw(__djgpp_dos_sel, (unsigned long)(p++)))==0xffff) { | ||||||
|  |         break; | ||||||
|  |      } | ||||||
|  |  | ||||||
|  |      r.x.ax = 0x4f01; | ||||||
|  |      r.x.cx = q->mode; | ||||||
|  |      r.x.di = 512; | ||||||
|  |      r.x.es = _stubinfo->ds_segment; | ||||||
|  |      __dpmi_int(0x10, &r); | ||||||
|  |      movedata(_stubinfo->ds_selector, 512, _my_ds(), (unsigned)tmp, 256); | ||||||
|  |      switch (tmp[M_BPP]) { | ||||||
|  |             case 16: | ||||||
|  |                  q->bpp = tmp[M_RED] + tmp[M_GREEN] + tmp[M_BLUE]; | ||||||
|  |                  break; | ||||||
|  |             case 8: | ||||||
|  |             case 15: | ||||||
|  |             case 24: | ||||||
|  |             case 32: | ||||||
|  |                  q->bpp = tmp[M_BPP]; | ||||||
|  |                  break; | ||||||
|  |             default: | ||||||
|  |                  q->bpp = 0; | ||||||
|  |      } | ||||||
|  |      if ((r.x.ax==0x004f) && ((tmp[M_ATTR]&0x11)==0x11) && q->bpp && (tmp[M_ATTR]&0x80)) { | ||||||
|  |         q->xres = _16_ tmp[M_XRES]; | ||||||
|  |         q->yres = _16_ tmp[M_YRES]; | ||||||
|  |         q->mode |= 0x4000; | ||||||
|  |         q++; | ||||||
|  |      } | ||||||
|  |  } while (TRUE); | ||||||
|  |  | ||||||
|  |  return modes; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: save current mode | ||||||
|  |  * | ||||||
|  |  * In  : ptr to mode structure | ||||||
|  |  * Out : 0 if success | ||||||
|  |  * | ||||||
|  |  * Note: shouldn't use VESA... | ||||||
|  |  */ | ||||||
|  | static int _mga_mode_save (MGA_MODE *p) | ||||||
|  | { | ||||||
|  |  __asm("\n\ | ||||||
|  | 		movw	$0x4f03, %%ax	\n\ | ||||||
|  | 		int	$0x10		\n\ | ||||||
|  | 		movl	%%ebx, %0	\n\ | ||||||
|  |  ":"=g"(p->mode)::"%eax", "%ebx"); | ||||||
|  |  return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: switch to specified mode | ||||||
|  |  * | ||||||
|  |  * In  : ptr to mode structure, refresh rate | ||||||
|  |  * Out : 0 if success | ||||||
|  |  * | ||||||
|  |  * Note: shouldn't use VESA... | ||||||
|  |  */ | ||||||
|  | int mga_mode_switch (MGA_MODE *p, int refresh) | ||||||
|  | { | ||||||
|  |  if (oldmode.mode == 0) { | ||||||
|  |     _mga_mode_save(&oldmode); | ||||||
|  |  } | ||||||
|  |  __asm("movw $0x4f02, %%ax; int  $0x10"::"b"(p->mode):"%eax"); | ||||||
|  |  return 0; | ||||||
|  |  | ||||||
|  |  (void)refresh; /* silence compiler warning */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: restore to the mode prior to first call to `mga_switch' | ||||||
|  |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : 0 if success | ||||||
|  |  * | ||||||
|  |  * Note: shouldn't use VESA... | ||||||
|  |  */ | ||||||
|  | int mga_mode_restore (void) | ||||||
|  | { | ||||||
|  |  if (oldmode.mode != 0) { | ||||||
|  |     __asm("movw $0x4f02, %%ax; int  $0x10"::"b"(oldmode.mode):"%eax"); | ||||||
|  |     oldmode.mode = 0; | ||||||
|  |  } | ||||||
|  |  return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: return suitable mode | ||||||
|  |  * | ||||||
|  |  * In  : width, height, bpp | ||||||
|  |  * Out : ptr to mode structure | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | MGA_MODE *mga_mode_find (int width, int height, int bpp) | ||||||
|  | { | ||||||
|  |  static MGA_MODE *q = NULL; | ||||||
|  |  | ||||||
|  |  MGA_MODE *p; | ||||||
|  |  unsigned int min; | ||||||
|  |  | ||||||
|  |  if (q == NULL) { | ||||||
|  |     if ((q = _mga_mode_check()) == NULL) { | ||||||
|  |        return NULL; | ||||||
|  |     } | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  /* search for a mode that fits our request */ | ||||||
|  |  for (min=-1, p=NULL; q->mode!=0xffff; q++) { | ||||||
|  |      if ((q->xres>=width) && (q->yres>=height) && (q->bpp==bpp)) { | ||||||
|  |         if (min>=(unsigned)(q->xres*q->yres)) { | ||||||
|  |            min = q->xres*q->yres; | ||||||
|  |            p = q; | ||||||
|  |         } | ||||||
|  |      } | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  return p; | ||||||
|  | } | ||||||
							
								
								
									
										47
									
								
								src/mesa/drivers/dos/mga/mga_mode.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/mesa/drivers/dos/mga/mga_mode.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  5.0 | ||||||
|  |  *  | ||||||
|  |  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | ||||||
|  |  *  | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  *  | ||||||
|  |  * The above copyright notice and this permission notice shall be included | ||||||
|  |  * in all copies or substantial portions of the Software. | ||||||
|  |  *  | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  |  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  |  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP device driver v1.3 for Mesa  --  MGA2064W mode switching | ||||||
|  |  * | ||||||
|  |  *  Copyright (c) 2003 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifndef MGA_MODE_included | ||||||
|  | #define MGA_MODE_included | ||||||
|  |  | ||||||
|  | typedef struct MGA_MODE { | ||||||
|  |         int mode; | ||||||
|  |         int xres, yres; | ||||||
|  |         int bpp; | ||||||
|  | } MGA_MODE; | ||||||
|  |  | ||||||
|  | int mga_mode_switch (MGA_MODE *p, int refresh); | ||||||
|  | int mga_mode_restore (void); | ||||||
|  | MGA_MODE *mga_mode_find (int width, int height, int bpp); | ||||||
|  |  | ||||||
|  | #endif | ||||||
							
								
								
									
										207
									
								
								src/mesa/drivers/dos/mga/mga_reg.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										207
									
								
								src/mesa/drivers/dos/mga/mga_reg.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,207 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  5.0 | ||||||
|  |  *  | ||||||
|  |  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. | ||||||
|  |  *  | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  *  | ||||||
|  |  * The above copyright notice and this permission notice shall be included | ||||||
|  |  * in all copies or substantial portions of the Software. | ||||||
|  |  *  | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  |  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  |  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP device driver v1.3 for Mesa  --  MGA2064W register mnemonics | ||||||
|  |  * | ||||||
|  |  *  Copyright (c) 2003 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifndef MGA_REG_H_included | ||||||
|  | #define MGA_REG_H_included | ||||||
|  |  | ||||||
|  | /* Matrox hardware registers: */ | ||||||
|  | #define M_AR0                 0x1C60 | ||||||
|  | #define M_AR1                 0x1C64 | ||||||
|  | #define M_AR2                 0x1C68 | ||||||
|  | #define M_AR3                 0x1C6C | ||||||
|  | #define M_AR4                 0x1C70 | ||||||
|  | #define M_AR5                 0x1C74 | ||||||
|  | #define M_AR6                 0x1C78 | ||||||
|  | #define M_BCOL                0x1C20 | ||||||
|  | #define M_CXBNDRY             0x1C80 | ||||||
|  | #define M_CXLEFT              0x1CA0 | ||||||
|  | #define M_CXRIGHT             0x1CA4 | ||||||
|  | #define M_DR0                 0x1CC0 | ||||||
|  | #define M_DR2                 0x1CC8 | ||||||
|  | #define M_DR3                 0x1CCC | ||||||
|  | #define M_DR4                 0x1CD0 | ||||||
|  | #define M_DR6                 0x1CD8 | ||||||
|  | #define M_DR7                 0x1CDC | ||||||
|  | #define M_DR8                 0x1CE0 | ||||||
|  | #define M_DR10                0x1CE8 | ||||||
|  | #define M_DR11                0x1CEC | ||||||
|  | #define M_DR12                0x1CF0 | ||||||
|  | #define M_DR14                0x1CF8 | ||||||
|  | #define M_DR15                0x1CFC | ||||||
|  | #define M_DWGCTL              0x1C00 | ||||||
|  | #define M_FCOL                0x1C24 | ||||||
|  | #define M_FIFOSTATUS          0x1E10 | ||||||
|  | #define M_FXBNDRY             0x1C84 | ||||||
|  | #define M_FXLEFT              0x1CA8 | ||||||
|  | #define M_FXRIGHT             0x1CAC | ||||||
|  | #define M_ICLEAR              0x1E18 | ||||||
|  | #define M_IEN                 0x1E1C | ||||||
|  | #define M_LEN                 0x1C5C | ||||||
|  | #define M_MACCESS             0x1C04 | ||||||
|  | #define M_OPMODE              0x1E54 | ||||||
|  | #define M_PAT0                0x1C10 | ||||||
|  | #define M_PAT1                0x1C14 | ||||||
|  | #define M_PITCH               0x1C8C | ||||||
|  | #define M_PLNWT               0x1C1C | ||||||
|  | #define M_RESET               0x1E40 | ||||||
|  | #define M_SGN                 0x1C58 | ||||||
|  | #define M_SHIFT               0x1C50 | ||||||
|  | #define M_SRC0                0x1C30 | ||||||
|  | #define M_SRC1                0x1C34 | ||||||
|  | #define M_SRC2                0x1C38 | ||||||
|  | #define M_SRC3                0x1C3C | ||||||
|  | #define M_STATUS              0x1E14 | ||||||
|  | #define M_VCOUNT              0x1E20 | ||||||
|  | #define M_XDST                0x1CB0 | ||||||
|  | #define M_XYEND               0x1C44 | ||||||
|  | #define M_XYSTRT              0x1C40 | ||||||
|  | #define M_YBOT                0x1C9C | ||||||
|  | #define M_YDST                0x1C90 | ||||||
|  | #define M_YDSTLEN             0x1C88 | ||||||
|  | #define M_YDSTORG             0x1C94 | ||||||
|  | #define M_YTOP                0x1C98 | ||||||
|  | #define M_ZORG                0x1C0C | ||||||
|  |  | ||||||
|  | #define M_EXEC                0x0100 | ||||||
|  |  | ||||||
|  | /* DWGCTL: opcod */ | ||||||
|  | #define M_DWG_LINE_OPEN       0x0 | ||||||
|  | #define M_DWG_AUTOLINE_OPEN   0x1 | ||||||
|  | #define M_DWG_LINE_CLOSE      0x2 | ||||||
|  | #define M_DWG_AUTOLINE_CLOSE  0x3 | ||||||
|  | #define M_DWG_TRAP            0x4 | ||||||
|  | #define M_DWG_TEXTURE_TRAP    0x5 | ||||||
|  | #define M_DWG_BITBLT          0x8 | ||||||
|  | #define M_DWG_FBITBLT         0xC | ||||||
|  | #define M_DWG_ILOAD           0x9 | ||||||
|  | #define M_DWG_ILOAD_SCALE     0xD | ||||||
|  | #define M_DWG_ILOAD_FILTER    0xF | ||||||
|  | #define M_DWG_IDUMP           0xA | ||||||
|  |  | ||||||
|  | /* DWGCTL: atype */ | ||||||
|  | #define M_DWG_RPL             (0x0 << 4) | ||||||
|  | #define M_DWG_RSTR            (0x1 << 4) | ||||||
|  | #define M_DWG_ZI              (0x3 << 4) | ||||||
|  | #define M_DWG_BLK             (0x4 << 4) | ||||||
|  | #define M_DWG_I               (0x7 << 4) | ||||||
|  |  | ||||||
|  | /* DWGCTL: linear */ | ||||||
|  | #define M_DWG_LINEAR          (0x1 << 7) | ||||||
|  |  | ||||||
|  | /* DWGCTL: zmode */ | ||||||
|  | #define M_DWG_NOZCMP          (0x0 << 8) | ||||||
|  | #define M_DWG_ZE              (0x2 << 8) | ||||||
|  | #define M_DWG_ZNE             (0x3 << 8) | ||||||
|  | #define M_DWG_ZLT             (0x4 << 8) | ||||||
|  | #define M_DWG_ZLTE            (0x5 << 8) | ||||||
|  | #define M_DWG_ZGT             (0x6 << 8) | ||||||
|  | #define M_DWG_ZGTE            (0x7 << 8) | ||||||
|  |  | ||||||
|  | /* DWGCTL: solid */ | ||||||
|  | #define M_DWG_SOLID           (0x1 << 11) | ||||||
|  |  | ||||||
|  | /* DWGCTL: arzero */ | ||||||
|  | #define M_DWG_ARZERO          (0x1 << 12) | ||||||
|  |  | ||||||
|  | /* DWGCTL: sgnzero */ | ||||||
|  | #define M_DWG_SGNZERO         (0x1 << 13) | ||||||
|  |  | ||||||
|  | /* DWGCTL: shiftzero */ | ||||||
|  | #define M_DWG_SHFTZERO        (0x1 << 14) | ||||||
|  |  | ||||||
|  | /* DWGCTL: bop */ | ||||||
|  | #define M_DWG_BOP_XOR         (0x6 << 16) | ||||||
|  | #define M_DWG_BOP_AND         (0x8 << 16) | ||||||
|  | #define M_DWG_BOP_SRC         (0xC << 16) | ||||||
|  | #define M_DWG_BOP_OR          (0xE << 16) | ||||||
|  |  | ||||||
|  | /* DWGCTL: trans */ | ||||||
|  | #define M_DWG_TRANS_0         (0x0 << 20) | ||||||
|  | #define M_DWG_TRANS_1         (0x1 << 20) | ||||||
|  | #define M_DWG_TRANS_2         (0x2 << 20) | ||||||
|  | #define M_DWG_TRANS_3         (0x3 << 20) | ||||||
|  | #define M_DWG_TRANS_4         (0x4 << 20) | ||||||
|  | #define M_DWG_TRANS_5         (0x5 << 20) | ||||||
|  | #define M_DWG_TRANS_6         (0x6 << 20) | ||||||
|  | #define M_DWG_TRANS_7         (0x7 << 20) | ||||||
|  | #define M_DWG_TRANS_8         (0x8 << 20) | ||||||
|  | #define M_DWG_TRANS_9         (0x9 << 20) | ||||||
|  | #define M_DWG_TRANS_A         (0xA << 20) | ||||||
|  | #define M_DWG_TRANS_B         (0xB << 20) | ||||||
|  | #define M_DWG_TRANS_C         (0xC << 20) | ||||||
|  | #define M_DWG_TRANS_D         (0xD << 20) | ||||||
|  | #define M_DWG_TRANS_E         (0xE << 20) | ||||||
|  | #define M_DWG_TRANS_F         (0xF << 20) | ||||||
|  |  | ||||||
|  | /* DWGCTL: bltmod */ | ||||||
|  | #define M_DWG_BMONOLEF        (0x0 << 25) | ||||||
|  | #define M_DWG_BMONOWF         (0x4 << 25) | ||||||
|  | #define M_DWG_BPLAN           (0x1 << 25) | ||||||
|  | #define M_DWG_BFCOL           (0x2 << 25) | ||||||
|  | #define M_DWG_BUYUV           (0xE << 25) | ||||||
|  | #define M_DWG_BU32BGR         (0x3 << 25) | ||||||
|  | #define M_DWG_BU32RGB         (0x7 << 25) | ||||||
|  | #define M_DWG_BU24BGR         (0xB << 25) | ||||||
|  | #define M_DWG_BU24RGB         (0xF << 25) | ||||||
|  |  | ||||||
|  | /* DWGCTL: pattern */ | ||||||
|  | #define M_DWG_PATTERN         (0x1 << 29) | ||||||
|  |  | ||||||
|  | /* DWGCTL: transc */ | ||||||
|  | #define M_DWG_TRANSC          (0x1 << 30) | ||||||
|  |  | ||||||
|  | /* OPMODE: */ | ||||||
|  | #define M_DMA_GENERAL         (0x0 << 2) | ||||||
|  | #define M_DMA_BLIT            (0x1 << 2) | ||||||
|  | #define M_DMA_VECTOR          (0x2 << 2) | ||||||
|  |  | ||||||
|  | /* SGN: */ | ||||||
|  | #define M_SDXL                (0x1 << 1) | ||||||
|  | #define M_SDXR                (0x1 << 5) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* VGAREG */ | ||||||
|  | #define M_CRTC_INDEX          0x1FD4 | ||||||
|  | #define M_CRTC_DATA           0x1FD5 | ||||||
|  |  | ||||||
|  | #define M_CRTC_EXT_INDEX      0x1FDE | ||||||
|  | #define M_CRTC_EXT_DATA       0x1FDF | ||||||
|  |  | ||||||
|  | #define M_MISC_R              0x1FCC | ||||||
|  | #define M_MISC_W              0x1FC2 | ||||||
|  |  | ||||||
|  | /* CRTCEXT3: */ | ||||||
|  | #define M_MGAMODE             (0x1 << 7) | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -23,7 +23,7 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * DOS/DJGPP device driver v1.2 for Mesa 4.1 |  * DOS/DJGPP device driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -32,24 +32,30 @@ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| #include <dpmi.h> | #include <dpmi.h> | ||||||
| #include <string.h> | #include <pc.h> | ||||||
|  | #include <stdlib.h> | ||||||
| #include <stubinfo.h> | #include <stubinfo.h> | ||||||
| #include <sys/exceptn.h> | #include <sys/exceptn.h> | ||||||
| #include <sys/segments.h> | #include <sys/segments.h> | ||||||
| #include <sys/farptr.h> | #include <sys/farptr.h> | ||||||
| #include <sys/movedata.h> | #include <sys/movedata.h> | ||||||
| 
 | 
 | ||||||
|  | #include "video.h" | ||||||
| #include "vesa.h" | #include "vesa.h" | ||||||
| #include "../dpmiint.h" |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| static vl_mode modes[64]; | static vl_mode modes[128]; | ||||||
| 
 | 
 | ||||||
| static word16 vesa_ver; | static word16 vesa_ver; | ||||||
| static int banked_selector, linear_selector; | static int banked_selector, linear_selector; | ||||||
| static int oldmode = -1; | static int oldmode = -1; | ||||||
| 
 | 
 | ||||||
|  | static int vesa_color_precision = 6; | ||||||
|  | 
 | ||||||
|  | static word16 *vesa_pmcode; | ||||||
|  | unsigned int vesa_gran_mask, vesa_gran_shift; | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
| @@ -100,11 +106,14 @@ typedef struct CRTCInfoBlock { | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /* vesa_init:
 | /* Desc: Attempts to detect VESA, check video modes and create selectors.
 | ||||||
|  *  Attempts to detect VESA, check video modes and create selectors. |  * | ||||||
|  *  Returns 0 if error. |  * In  : - | ||||||
|  |  * Out : mode array | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  */ |  */ | ||||||
| static word16 vesa_init (void) | static vl_mode *vesa_init (void) | ||||||
| { | { | ||||||
|  __dpmi_regs r; |  __dpmi_regs r; | ||||||
|  word16 *p; |  word16 *p; | ||||||
| @@ -114,7 +123,7 @@ static word16 vesa_init (void) | |||||||
|  word32 linearfb = 0; |  word32 linearfb = 0; | ||||||
| 
 | 
 | ||||||
|  if (vesa_ver) { |  if (vesa_ver) { | ||||||
|     return vesa_ver; |     return modes; | ||||||
|  } |  } | ||||||
| 
 | 
 | ||||||
|  _farpokel(_stubinfo->ds_selector, 0, 0x32454256); |  _farpokel(_stubinfo->ds_selector, 0, 0x32454256); | ||||||
| @@ -124,7 +133,7 @@ static word16 vesa_init (void) | |||||||
|  __dpmi_int(0x10, &r); |  __dpmi_int(0x10, &r); | ||||||
|  movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512); |  movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512); | ||||||
|  if ((r.x.ax!=0x004f) || ((_32_ vesa_info[V_SIGN])!=0x41534556)) { |  if ((r.x.ax!=0x004f) || ((_32_ vesa_info[V_SIGN])!=0x41534556)) { | ||||||
|     return 0; |     return NULL; | ||||||
|  } |  } | ||||||
| 
 | 
 | ||||||
|  p = (word16 *)(((_16_ vesa_info[V_MODE_SEG])<<4) + (_16_ vesa_info[V_MODE_OFS])); |  p = (word16 *)(((_16_ vesa_info[V_MODE_SEG])<<4) + (_16_ vesa_info[V_MODE_OFS])); | ||||||
| @@ -144,6 +153,7 @@ static word16 vesa_init (void) | |||||||
|             case 16: |             case 16: | ||||||
|                  q->bpp = tmp[M_RED] + tmp[M_GREEN] + tmp[M_BLUE]; |                  q->bpp = tmp[M_RED] + tmp[M_GREEN] + tmp[M_BLUE]; | ||||||
|                  break; |                  break; | ||||||
|  |             case 8: | ||||||
|             case 15: |             case 15: | ||||||
|             case 24: |             case 24: | ||||||
|             case 32: |             case 32: | ||||||
| @@ -175,54 +185,78 @@ static word16 vesa_init (void) | |||||||
|  } while (TRUE); |  } while (TRUE); | ||||||
| 
 | 
 | ||||||
|  if (q==modes) { |  if (q==modes) { | ||||||
|     return 0; |     return NULL; | ||||||
|  } |  } | ||||||
|  if (linearfb) { |  if (linearfb) { | ||||||
|     maxsize = ((maxsize+0xfffUL)&~0xfffUL); |     maxsize = ((maxsize+0xfffUL)&~0xfffUL); | ||||||
|     if (_create_selector(&linear_selector, linearfb, maxsize)) { |     if (_create_selector(&linear_selector, linearfb, maxsize)) { | ||||||
|        return 0; |        return NULL; | ||||||
|     } |     } | ||||||
|  } |  } | ||||||
|  if (_create_selector(&banked_selector, 0xa0000, modes[0].gran)) { |  if (_create_selector(&banked_selector, 0xa0000, modes[0].gran)) { | ||||||
|     _remove_selector(&linear_selector); |     _remove_selector(&linear_selector); | ||||||
|     return 0; |     return NULL; | ||||||
|  } |  } | ||||||
| 
 | 
 | ||||||
|  for (q=modes; q->mode!=0xffff; q++) { |  for (q=modes; q->mode!=0xffff; q++) { | ||||||
|      q->sel = (q->mode&0x4000) ? linear_selector : banked_selector; |      q->sel = (q->mode&0x4000) ? linear_selector : banked_selector; | ||||||
|  } |  } | ||||||
| 
 | 
 | ||||||
|  return (vesa_ver = _16_ vesa_info[V_MINOR]); |  if (vesa_info[V_MAJOR] >= 2) { | ||||||
|  |     r.x.ax = 0x4f0a; | ||||||
|  |     r.x.bx = 0; | ||||||
|  |     __dpmi_int(0x10, &r); | ||||||
|  |     if (r.x.ax == 0x004f) { | ||||||
|  |        vesa_pmcode = (word16 *)malloc(r.x.cx); | ||||||
|  |        movedata(__djgpp_dos_sel, (r.x.es << 4) + r.x.di, _my_ds(), (unsigned)vesa_pmcode, r.x.cx); | ||||||
|  |        if (vesa_pmcode[3]) { | ||||||
|  |           p = (word16 *)((long)vesa_pmcode + vesa_pmcode[3]); | ||||||
|  |           while (*p++ != 0xffff) ; | ||||||
|  |        } else { | ||||||
|  |           p = NULL; | ||||||
|  |        } | ||||||
|  |        if (p && (*p != 0xffff)) { | ||||||
|  |           free(vesa_pmcode); | ||||||
|  |           vesa_pmcode = NULL; | ||||||
|  |        } else { | ||||||
|  |           vesa_swbank = (void *)((long)vesa_pmcode + vesa_pmcode[0]); | ||||||
|  |        } | ||||||
|  |     } | ||||||
|  |  } | ||||||
|  | 
 | ||||||
|  |  vesa_ver = _16_ vesa_info[V_MINOR]; | ||||||
|  |  return modes; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /* vesa_finit:
 | /* Desc: Frees all resources allocated by VESA init code.
 | ||||||
|  *  Frees all resources allocated by VESA init code. |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  */ |  */ | ||||||
| static void vesa_finit (void) | static void vesa_fini (void) | ||||||
| { | { | ||||||
|  if (vesa_ver) { |  if (vesa_ver) { | ||||||
|     _remove_selector(&linear_selector); |     _remove_selector(&linear_selector); | ||||||
|     _remove_selector(&banked_selector); |     _remove_selector(&banked_selector); | ||||||
|  |     if (vesa_pmcode != NULL) { | ||||||
|  |        free(vesa_pmcode); | ||||||
|  |        vesa_pmcode = NULL; | ||||||
|  |     } | ||||||
|  } |  } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /* vesa_getmodes:
 | /* Desc: Uses VESA 3.0 function 0x4F0B to find the closest pixel clock to the requested value.
 | ||||||
|  *  Returns ptr to mode array. |  * | ||||||
|  */ |  * In  : mode, clock | ||||||
| static vl_mode *vesa_getmodes (void) |  * Out : desired clock | ||||||
| { |  * | ||||||
|  return (vesa_init() == 0) ? NULL : modes; |  * Note: - | ||||||
| } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| /* _closest_pixclk:
 |  | ||||||
|  *  Uses VESA 3.0 function 0x4F0B to find the closest pixel clock to the |  | ||||||
|  *  requested value. |  | ||||||
|  */ |  */ | ||||||
| static unsigned long _closest_pixclk (int mode_no, unsigned long vclk) | static unsigned long _closest_pixclk (int mode_no, unsigned long vclk) | ||||||
| { | { | ||||||
| @@ -239,8 +273,12 @@ static unsigned long _closest_pixclk (int mode_no, unsigned long vclk) | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /* _crtc_timing:
 | /* Desc: Calculates CRTC mode timings.
 | ||||||
|  *  Calculates CRTC mode timings. |  * | ||||||
|  |  * In  : crtc block, geometry, adjust | ||||||
|  |  * Out : | ||||||
|  |  * | ||||||
|  |  * Note: | ||||||
|  */ |  */ | ||||||
| static void _crtc_timing (CRTCInfoBlock *crtc, int xres, int yres, int xadjust, int yadjust) | static void _crtc_timing (CRTCInfoBlock *crtc, int xres, int yres, int xadjust, int yadjust) | ||||||
| { | { | ||||||
| @@ -318,16 +356,28 @@ static void _crtc_timing (CRTCInfoBlock *crtc, int xres, int yres, int xadjust, | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /* vesa_entermode:
 | /* Desc: Attempts to enter specified video mode.
 | ||||||
|  *  Attempts to enter specified video mode. |  | ||||||
|  * |  * | ||||||
|  *  success: 0 |  * In  : ptr to mode structure, refresh rate | ||||||
|  *  failure: !0 |  * Out : 0 if success | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  */ |  */ | ||||||
| static int vesa_entermode (vl_mode *p, int refresh) | static int vesa_entermode (vl_mode *p, int refresh) | ||||||
| { | { | ||||||
|  __dpmi_regs r; |  __dpmi_regs r; | ||||||
| 
 | 
 | ||||||
|  |  if (p->mode & 0x4000) { | ||||||
|  |     VESA.blit = _can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual; | ||||||
|  |  } else { | ||||||
|  |     VESA.blit = vesa_b_dump_virtual; | ||||||
|  |     { int n; for (vesa_gran_shift=0, n=p->gran; n; vesa_gran_shift++, n>>=1) ; } | ||||||
|  |     vesa_gran_mask = (1<<(--vesa_gran_shift)) - 1; | ||||||
|  |     if ((unsigned)p->gran != (vesa_gran_mask+1)) { | ||||||
|  |        return !0; | ||||||
|  |     } | ||||||
|  |  } | ||||||
|  | 
 | ||||||
|  if (oldmode == -1) { |  if (oldmode == -1) { | ||||||
|     r.x.ax = 0x4f03; |     r.x.ax = 0x4f03; | ||||||
|     __dpmi_int(0x10, &r); |     __dpmi_int(0x10, &r); | ||||||
| @@ -364,14 +414,33 @@ static int vesa_entermode (vl_mode *p, int refresh) | |||||||
|  } |  } | ||||||
| 
 | 
 | ||||||
|  __dpmi_int(0x10, &r); |  __dpmi_int(0x10, &r); | ||||||
|  |  if (r.x.ax != 0x004f) { | ||||||
|  |     return !0; | ||||||
|  |  } | ||||||
| 
 | 
 | ||||||
|  return (r.x.ax != 0x004f); |  if (p->bpp == 8) { | ||||||
|  |     r.x.ax = 0x4f08; | ||||||
|  |     r.x.bx = 0x0800; | ||||||
|  |     __dpmi_int(0x10, &r); | ||||||
|  |     if (r.x.ax == 0x004f) { | ||||||
|  |        r.x.ax = 0x4f08; | ||||||
|  |        r.h.bl = 0x01; | ||||||
|  |        __dpmi_int(0x10, &r); | ||||||
|  |        vesa_color_precision = r.h.bh; | ||||||
|  |     } | ||||||
|  |  } | ||||||
|  | 
 | ||||||
|  |  return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /* vesa_restore:
 | /* Desc: Restores to the mode prior to first call to vesa_entermode.
 | ||||||
|  *  Restores to the mode prior to first call to vesa_entermode. |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  */ |  */ | ||||||
| static void vesa_restore (void) | static void vesa_restore (void) | ||||||
| { | { | ||||||
| @@ -386,12 +455,79 @@ static void vesa_restore (void) | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | /* Desc: set one palette entry
 | ||||||
|  |  * | ||||||
|  |  * In  : color index, R, G, B | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: uses integer values | ||||||
|  |  */ | ||||||
|  | static void vesa_setCI_i (int index, int red, int green, int blue) | ||||||
|  | { | ||||||
|  | #if 0 | ||||||
|  |  __asm("\n\
 | ||||||
|  | 		movw $0x1010, %%ax	\n\ | ||||||
|  | 		movb %1, %%dh		\n\ | ||||||
|  | 		movb %2, %%ch		\n\ | ||||||
|  | 		int  $0x10		\n\ | ||||||
|  |  "::"b"(index), "m"(red), "m"(green), "c"(blue):"%eax", "%edx"); | ||||||
|  | #else | ||||||
|  |  outportb(0x03C8, index); | ||||||
|  |  outportb(0x03C9, red); | ||||||
|  |  outportb(0x03C9, green); | ||||||
|  |  outportb(0x03C9, blue); | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /* Desc: set one palette entry
 | ||||||
|  |  * | ||||||
|  |  * In  : color index, R, G, B | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: uses normalized values | ||||||
|  |  */ | ||||||
|  | static void vesa_setCI_f (int index, float red, float green, float blue) | ||||||
|  | { | ||||||
|  |  float max = (1 << vesa_color_precision) - 1; | ||||||
|  | 
 | ||||||
|  |  vesa_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /* Desc: state retrieval
 | ||||||
|  |  * | ||||||
|  |  * In  : parameter name, ptr to storage | ||||||
|  |  * Out : 0 if request successfully processed | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | static int vesa_get (int pname, int *params) | ||||||
|  | { | ||||||
|  |  switch (pname) { | ||||||
|  |         case VL_GET_CI_PREC: | ||||||
|  |              params[0] = vesa_color_precision; | ||||||
|  |              break; | ||||||
|  |         default: | ||||||
|  |              return -1; | ||||||
|  |  } | ||||||
|  |  return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * the driver |  * the driver | ||||||
|  */ |  */ | ||||||
| vl_driver VESA = { | vl_driver VESA = { | ||||||
|           vesa_getmodes, |           vesa_init, | ||||||
|           vesa_entermode, |           vesa_entermode, | ||||||
|  |           NULL, | ||||||
|  |           vesa_setCI_f, | ||||||
|  |           vesa_setCI_i, | ||||||
|  |           vesa_get, | ||||||
|           vesa_restore, |           vesa_restore, | ||||||
|           vesa_finit |           vesa_fini | ||||||
| }; | }; | ||||||
| @@ -23,7 +23,7 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * DOS/DJGPP device driver v1.1 for Mesa 4.0 |  * DOS/DJGPP device driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -34,9 +34,13 @@ | |||||||
| #ifndef VESA_H_included | #ifndef VESA_H_included | ||||||
| #define VESA_H_included | #define VESA_H_included | ||||||
| 
 | 
 | ||||||
| #include "../videoint.h" | #include "internal.h" | ||||||
| 
 | 
 | ||||||
|  | extern void *vesa_swbank; | ||||||
| 
 | 
 | ||||||
|  | extern void vesa_b_dump_virtual (void); | ||||||
|  | extern void vesa_l_dump_virtual (void); | ||||||
|  | extern void vesa_l_dump_virtual_mmx (void); | ||||||
| 
 | 
 | ||||||
| extern vl_driver VESA; | extern vl_driver VESA; | ||||||
| 
 | 
 | ||||||
							
								
								
									
										235
									
								
								src/mesa/drivers/dos/vga.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										235
									
								
								src/mesa/drivers/dos/vga.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,235 @@ | |||||||
|  | /* | ||||||
|  |  * Mesa 3-D graphics library | ||||||
|  |  * Version:  4.1 | ||||||
|  |  *  | ||||||
|  |  * Copyright (C) 1999  Brian Paul   All Rights Reserved. | ||||||
|  |  *  | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  *  | ||||||
|  |  * The above copyright notice and this permission notice shall be included | ||||||
|  |  * in all copies or substantial portions of the Software. | ||||||
|  |  *  | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||||
|  |  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||||||
|  |  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||||
|  |  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DOS/DJGPP device driver v1.3 for Mesa | ||||||
|  |  * | ||||||
|  |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  |  *  Email : dborca@yahoo.com | ||||||
|  |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #include <pc.h> | ||||||
|  | #include <stdlib.h> | ||||||
|  |  | ||||||
|  | #include "video.h" | ||||||
|  | #include "vga.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | static vl_mode modes[] = { | ||||||
|  |        {0x13 | 0x4000, 320, 200, 320, 8, -1, 320*200}, | ||||||
|  |        {0xffff, -1, -1, -1, -1, -1, -1} | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | static word16 vga_ver; | ||||||
|  | static int linear_selector; | ||||||
|  | static int oldmode = -1; | ||||||
|  |  | ||||||
|  | #define vga_color_precision 6 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: Attempts to detect VGA, check video modes and create selectors. | ||||||
|  |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : mode array | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | static vl_mode *vga_init (void) | ||||||
|  | { | ||||||
|  |  int rv = 0; | ||||||
|  |  | ||||||
|  |  if (vga_ver) { | ||||||
|  |     return modes; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  __asm("\n\ | ||||||
|  | 		movw	$0x1a00, %%ax	\n\ | ||||||
|  | 		int	$0x10		\n\ | ||||||
|  | 		cmpb	$0x1a, %%al	\n\ | ||||||
|  | 		jne	0f		\n\ | ||||||
|  | 		cmpb	$0x07, %%bl	\n\ | ||||||
|  | 		jb	0f		\n\ | ||||||
|  | 		andl	$0xff, %%ebx	\n\ | ||||||
|  | 		movl	%%ebx, %0	\n\ | ||||||
|  |  0:":"=g"(rv)::"%eax", "%ebx"); | ||||||
|  |  if (rv == 0) { | ||||||
|  |     return NULL; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  if (_create_selector(&linear_selector, 0xa0000, 0x10000)) { | ||||||
|  |     return NULL; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  modes[0].sel = linear_selector; | ||||||
|  |  | ||||||
|  |  vga_ver = rv; | ||||||
|  |  return modes; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: Frees all resources allocated by VGA init code. | ||||||
|  |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | static void vga_fini (void) | ||||||
|  | { | ||||||
|  |  if (vga_ver) { | ||||||
|  |     _remove_selector(&linear_selector); | ||||||
|  |  } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: Attempts to enter specified video mode. | ||||||
|  |  * | ||||||
|  |  * In  : ptr to mode structure, refresh rate | ||||||
|  |  * Out : 0 if success | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | static int vga_entermode (vl_mode *p, int refresh) | ||||||
|  | { | ||||||
|  |  if (!(p->mode & 0x4000)) { | ||||||
|  |     return -1; | ||||||
|  |  } | ||||||
|  |  VGA.blit = _can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual; | ||||||
|  |  | ||||||
|  |  if (oldmode == -1) { | ||||||
|  |     __asm("\n\ | ||||||
|  | 		movb	$0x0f, %%ah	\n\ | ||||||
|  | 		int	$0x10		\n\ | ||||||
|  | 		andl	$0xff, %%eax	\n\ | ||||||
|  | 		movl	%%eax, %0	\n\ | ||||||
|  |     ":"=g"(oldmode)::"%eax", "%ebx"); | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  __asm("int $0x10"::"a"(p->mode&0xff)); | ||||||
|  |  | ||||||
|  |  return 0; | ||||||
|  |  | ||||||
|  |  (void)refresh; /* silence compiler warning */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: Restores to the mode prior to first call to vga_entermode. | ||||||
|  |  * | ||||||
|  |  * In  : - | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | static void vga_restore (void) | ||||||
|  | { | ||||||
|  |  if (oldmode != -1) { | ||||||
|  |     __asm("int $0x10"::"a"(oldmode)); | ||||||
|  |  } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: set one palette entry | ||||||
|  |  * | ||||||
|  |  * In  : color index, R, G, B | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: uses integer values | ||||||
|  |  */ | ||||||
|  | static void vga_setCI_i (int index, int red, int green, int blue) | ||||||
|  | { | ||||||
|  | #if 0 | ||||||
|  |  __asm("\n\ | ||||||
|  | 		movw $0x1010, %%ax	\n\ | ||||||
|  | 		movb %1, %%dh		\n\ | ||||||
|  | 		movb %2, %%ch		\n\ | ||||||
|  | 		int  $0x10		\n\ | ||||||
|  |  "::"b"(index), "m"(red), "m"(green), "c"(blue):"%eax", "%edx"); | ||||||
|  | #else | ||||||
|  |  outportb(0x03C8, index); | ||||||
|  |  outportb(0x03C9, red); | ||||||
|  |  outportb(0x03C9, green); | ||||||
|  |  outportb(0x03C9, blue); | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: set one palette entry | ||||||
|  |  * | ||||||
|  |  * In  : color index, R, G, B | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: uses normalized values | ||||||
|  |  */ | ||||||
|  | static void vga_setCI_f (int index, float red, float green, float blue) | ||||||
|  | { | ||||||
|  |  float max = (1 << vga_color_precision) - 1; | ||||||
|  |  | ||||||
|  |  vga_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: state retrieval | ||||||
|  |  * | ||||||
|  |  * In  : parameter name, ptr to storage | ||||||
|  |  * Out : 0 if request successfully processed | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | static int vga_get (int pname, int *params) | ||||||
|  | { | ||||||
|  |  switch (pname) { | ||||||
|  |         case VL_GET_CI_PREC: | ||||||
|  |              params[0] = vga_color_precision; | ||||||
|  |              break; | ||||||
|  |         default: | ||||||
|  |              return -1; | ||||||
|  |  } | ||||||
|  |  return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * the driver | ||||||
|  |  */ | ||||||
|  | vl_driver VGA = { | ||||||
|  |           vga_init, | ||||||
|  |           vga_entermode, | ||||||
|  |           NULL, | ||||||
|  |           vga_setCI_f, | ||||||
|  |           vga_setCI_i, | ||||||
|  |           vga_get, | ||||||
|  |           vga_restore, | ||||||
|  |           vga_fini | ||||||
|  | }; | ||||||
| @@ -23,7 +23,7 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * DOS/DJGPP device driver v1.1 for Mesa 4.0 |  * DOS/DJGPP device driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
| @@ -31,10 +31,12 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| #ifndef DPMIINT_H_included | #ifndef VGA_H_included | ||||||
| #define DPMIINT_H_included | #define VGA_H_included | ||||||
| 
 | 
 | ||||||
| int _create_selector (int *segment, unsigned long base, int size); | #include "internal.h" | ||||||
| void _remove_selector (int *segment); | #include "vesa.h" | ||||||
|  | 
 | ||||||
|  | extern vl_driver VGA; | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| @@ -23,87 +23,129 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * DOS/DJGPP device driver v1.1 for Mesa 4.0 |  * DOS/DJGPP device driver v1.3 for Mesa | ||||||
|  * |  * | ||||||
|  *  Copyright (C) 2002 - Borca Daniel |  *  Copyright (C) 2002 - Borca Daniel | ||||||
|  *  Email : dborca@yahoo.com |  *  Email : dborca@yahoo.com | ||||||
|  *  Web   : http://www.geocities.com/dborca |  *  Web   : http://www.geocities.com/dborca | ||||||
|  |  * | ||||||
|  |  * Thanks to CrazyPyro (Neil Funk) for FakeColor | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
|  |  | ||||||
|  | #include "internal.h" | ||||||
|  | #include "vesa.h" | ||||||
|  | #include "vga.h" | ||||||
| #include "video.h" | #include "video.h" | ||||||
| #include "videoint.h" |  | ||||||
| #include "vesa/vesa.h" |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| static vl_driver *drv = &VESA; | static vl_driver *drv; | ||||||
| /* card specific: valid forever */ |  | ||||||
| word32 vl_hw_granularity; |  | ||||||
| static unsigned int gran_shift, gran_mask; |  | ||||||
| /* based upon mode specific data: valid entire session */ | /* based upon mode specific data: valid entire session */ | ||||||
| int vl_video_selector; | int vl_video_selector; | ||||||
|  | static vl_mode *video_mode; | ||||||
| static int video_scanlen, video_bypp; | static int video_scanlen, video_bypp; | ||||||
| /* valid until next buffer */ | /* valid until next buffer */ | ||||||
|  | void *vl_current_draw_buffer, *vl_current_read_buffer; | ||||||
|  | int vl_current_stride, vl_current_width, vl_current_height, vl_current_bytes; | ||||||
| int vl_current_offset, vl_current_delta; | int vl_current_offset, vl_current_delta; | ||||||
| static int current_width; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* lookup table for scaling 5 bit colors up to 8 bits */ | /* lookup table for scaling 5 bit colors up to 8 bits */ | ||||||
| static int _rgb_scale_5[32] = { | static int _rgb_scale_5[32] = { | ||||||
|    0,   8,   16,  24,  32,  41,  49,  57, |    0,   8,   16,  25,  33,  41,  49,  58, | ||||||
|    65,  74,  82,  90,  98,  106, 115, 123, |    66,  74,  82,  90,  99,  107, 115, 123, | ||||||
|    131, 139, 148, 156, 164, 172, 180, 189, |    132, 140, 148, 156, 165, 173, 181, 189, | ||||||
|    197, 205, 213, 222, 230, 238, 246, 255 |    197, 206, 214, 222, 230, 239, 247, 255 | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /* lookup table for scaling 6 bit colors up to 8 bits */ | /* lookup table for scaling 6 bit colors up to 8 bits */ | ||||||
| static int _rgb_scale_6[64] = { | static int _rgb_scale_6[64] = { | ||||||
|    0,   4,   8,   12,  16,  20,  24,  28, |    0,   4,   8,   12,  16,  20,  24,  28, | ||||||
|    32,  36,  40,  44,  48,  52,  56,  60, |    32,  36,  40,  45,  49,  53,  57,  61, | ||||||
|    64,  68,  72,  76,  80,  85,  89,  93, |    65,  69,  73,  77,  81,  85,  89,  93, | ||||||
|    97,  101, 105, 109, 113, 117, 121, 125, |    97,  101, 105, 109, 113, 117, 121, 125, | ||||||
|    129, 133, 137, 141, 145, 149, 153, 157, |    130, 134, 138, 142, 146, 150, 154, 158, | ||||||
|    161, 165, 170, 174, 178, 182, 186, 190, |    162, 166, 170, 174, 178, 182, 186, 190, | ||||||
|    194, 198, 202, 206, 210, 214, 218, 222, |    194, 198, 202, 206, 210, 215, 219, 223, | ||||||
|    226, 230, 234, 238, 242, 246, 250, 255 |    227, 231, 235, 239, 243, 247, 251, 255 | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | /* FakeColor data */ | ||||||
|  | #define R_CNT 6 | ||||||
|  | #define G_CNT 6 | ||||||
|  | #define B_CNT 6 | ||||||
|  |  | ||||||
|  | #define R_BIAS 7 | ||||||
|  | #define G_BIAS 7 | ||||||
|  | #define B_BIAS 7 | ||||||
|  |  | ||||||
|  | static word32 VGAPalette[256]; | ||||||
|  | static word8 array_r[256]; | ||||||
|  | static word8 array_g[256]; | ||||||
|  | static word8 array_b[256]; | ||||||
|  |  | ||||||
|  |  | ||||||
| void (*vl_clear) (void *buffer, int bytes, int color); |  | ||||||
| void (*vl_flip) (void *buffer, int stride, int height); | int (*vl_mixfix) (fixed r, fixed g, fixed b); | ||||||
| int (*vl_mixrgba) (const unsigned char rgba[]); |  | ||||||
| int (*vl_mixrgb) (const unsigned char rgb[]); | int (*vl_mixrgb) (const unsigned char rgb[]); | ||||||
| void (*vl_putpixel) (void *buffer, int offset, int color); | int (*vl_mixrgba) (const unsigned char rgba[]); | ||||||
| void (*vl_getrgba) (void *buffer, int offset, unsigned char rgba[4]); | void (*vl_getrgba) (unsigned int offset, unsigned char rgba[4]); | ||||||
|  | int (*vl_getpixel) (unsigned int offset); | ||||||
|  | void (*vl_clear) (int color); | ||||||
|  | void (*vl_rect) (int x, int y, int width, int height, int color); | ||||||
|  | void (*vl_flip) (void); | ||||||
|  | void (*vl_putpixel) (unsigned int offset, int color); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* vl_rect: | /* Desc: color composition (w/o ALPHA) | ||||||
|  *  Clears a rectange with specified color. |  * | ||||||
|  |  * In  : R, G, B | ||||||
|  |  * Out : color | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  */ |  */ | ||||||
| void vl_rect (void *buffer, int x, int y, int width, int height, int color) | static int vl_mixfix8fake (fixed r, fixed g, fixed b) | ||||||
| { | { | ||||||
|  int offset = y*current_width + x; |  return array_b[b>>FIXED_SHIFT]*G_CNT*R_CNT | ||||||
|  int delta = current_width - width; |       + array_g[g>>FIXED_SHIFT]*R_CNT | ||||||
|  |       + array_r[r>>FIXED_SHIFT]; | ||||||
|  for (y=0; y<height; y++) { | } | ||||||
|      for (x=0; x<width; x++, offset++) { | #define vl_mixfix8 vl_mixfix8fake | ||||||
|          vl_putpixel(buffer, offset, color); | static int vl_mixfix15 (fixed r, fixed g, fixed b) | ||||||
|      } | { | ||||||
|      offset += delta; |  return ((r>>(3+FIXED_SHIFT))<<10) | ||||||
|  } |        |((g>>(3+FIXED_SHIFT))<<5) | ||||||
|  |        |(b>>(3+FIXED_SHIFT)); | ||||||
|  | } | ||||||
|  | static int vl_mixfix16 (fixed r, fixed g, fixed b) | ||||||
|  | { | ||||||
|  |  return ((r>>(3+FIXED_SHIFT))<<11) | ||||||
|  |        |((g>>(2+FIXED_SHIFT))<<5) | ||||||
|  |        |(b>>(3+FIXED_SHIFT)); | ||||||
|  | } | ||||||
|  | #define vl_mixfix24 vl_mixfix32 | ||||||
|  | static int vl_mixfix32 (fixed r, fixed g, fixed b) | ||||||
|  | { | ||||||
|  |  return ((r>>FIXED_SHIFT)<<16) | ||||||
|  |        |((g>>FIXED_SHIFT)<<8) | ||||||
|  |        |(b>>FIXED_SHIFT); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* vl_mixrgba*: | /* Desc: color composition (w/ ALPHA) | ||||||
|  *  Color composition (w/ ALPHA). |  * | ||||||
|  |  * In  : array of integers (R, G, B, A) | ||||||
|  |  * Out : color | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  */ |  */ | ||||||
|  | #define vl_mixrgba8 vl_mixrgb8fake | ||||||
| #define vl_mixrgba15 vl_mixrgb15 | #define vl_mixrgba15 vl_mixrgb15 | ||||||
| #define vl_mixrgba16 vl_mixrgb16 | #define vl_mixrgba16 vl_mixrgb16 | ||||||
| #define vl_mixrgba24 vl_mixrgb24 | #define vl_mixrgba24 vl_mixrgb24 | ||||||
| @@ -114,9 +156,20 @@ static int vl_mixrgba32 (const unsigned char rgba[]) | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* vl_mixrgb*: | /* Desc: color composition (w/o ALPHA) | ||||||
|  *  Color composition (w/o ALPHA). |  * | ||||||
|  |  * In  : array of integers (R, G, B) | ||||||
|  |  * Out : color | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  */ |  */ | ||||||
|  | static int vl_mixrgb8fake (const unsigned char rgba[]) | ||||||
|  | { | ||||||
|  |  return array_b[rgba[2]]*G_CNT*R_CNT | ||||||
|  |       + array_g[rgba[1]]*R_CNT | ||||||
|  |       + array_r[rgba[0]]; | ||||||
|  | } | ||||||
|  | #define vl_mixrgb8 vl_mixrgb8fake | ||||||
| static int vl_mixrgb15 (const unsigned char rgb[]) | static int vl_mixrgb15 (const unsigned char rgb[]) | ||||||
| { | { | ||||||
|  return ((rgb[0]>>3)<<10)|((rgb[1]>>3)<<5)|(rgb[2]>>3); |  return ((rgb[0]>>3)<<10)|((rgb[1]>>3)<<5)|(rgb[2]>>3); | ||||||
| @@ -133,36 +186,57 @@ static int vl_mixrgb32 (const unsigned char rgb[]) | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* v_getrgba*: | /* Desc: color decomposition | ||||||
|  *  Color decomposition. |  * | ||||||
|  |  * In  : pixel offset, array of integers to hold color components (R, G, B, A) | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: uses current read buffer | ||||||
|  */ |  */ | ||||||
| static void v_getrgba15 (void *buffer, int offset, unsigned char rgba[4]) | static void v_getrgba8fake6 (unsigned int offset, unsigned char rgba[]) | ||||||
| { | { | ||||||
|  int c = ((word16 *)buffer)[offset]; |  word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]]; | ||||||
|  |  rgba[0] = _rgb_scale_6[(c >> 16) & 0x3F]; | ||||||
|  |  rgba[1] = _rgb_scale_6[(c >> 8) & 0x3F]; | ||||||
|  |  rgba[2] = _rgb_scale_6[c & 0x3F]; | ||||||
|  |  rgba[3] = c >> 24; | ||||||
|  | } | ||||||
|  | static void v_getrgba8fake8 (unsigned int offset, unsigned char rgba[]) | ||||||
|  | { | ||||||
|  |  word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]]; | ||||||
|  |  rgba[0] = c >> 16; | ||||||
|  |  rgba[1] = c >> 8; | ||||||
|  |  rgba[2] = c; | ||||||
|  |  rgba[3] = c >> 24; | ||||||
|  | } | ||||||
|  | #define v_getrgba8 v_getrgba8fake6 | ||||||
|  | static void v_getrgba15 (unsigned int offset, unsigned char rgba[4]) | ||||||
|  | { | ||||||
|  |  word32 c = ((word16 *)vl_current_read_buffer)[offset]; | ||||||
|  rgba[0] = _rgb_scale_5[(c >> 10) & 0x1F]; |  rgba[0] = _rgb_scale_5[(c >> 10) & 0x1F]; | ||||||
|  rgba[1] = _rgb_scale_5[(c >> 5) & 0x1F]; |  rgba[1] = _rgb_scale_5[(c >> 5) & 0x1F]; | ||||||
|  rgba[2] = _rgb_scale_5[c & 0x1F]; |  rgba[2] = _rgb_scale_5[c & 0x1F]; | ||||||
|  rgba[3] = 255; |  rgba[3] = 255; | ||||||
| } | } | ||||||
| static void v_getrgba16 (void *buffer, int offset, unsigned char rgba[4]) | static void v_getrgba16 (unsigned int offset, unsigned char rgba[4]) | ||||||
| { | { | ||||||
|  int c = ((word16 *)buffer)[offset]; |  word32 c = ((word16 *)vl_current_read_buffer)[offset]; | ||||||
|  rgba[0] = _rgb_scale_5[(c >> 11) & 0x1F]; |  rgba[0] = _rgb_scale_5[(c >> 11) & 0x1F]; | ||||||
|  rgba[1] = _rgb_scale_6[(c >> 5) & 0x3F]; |  rgba[1] = _rgb_scale_6[(c >> 5) & 0x3F]; | ||||||
|  rgba[2] = _rgb_scale_5[c & 0x1F]; |  rgba[2] = _rgb_scale_5[c & 0x1F]; | ||||||
|  rgba[3] = 255; |  rgba[3] = 255; | ||||||
| } | } | ||||||
| static void v_getrgba24 (void *buffer, int offset, unsigned char rgba[4]) | static void v_getrgba24 (unsigned int offset, unsigned char rgba[4]) | ||||||
| { | { | ||||||
|  int c = *(word32 *)((long)buffer+offset*3); |  word32 c = *(word32 *)((long)vl_current_read_buffer+offset*3); | ||||||
|  rgba[0] = c >> 16; |  rgba[0] = c >> 16; | ||||||
|  rgba[1] = c >> 8; |  rgba[1] = c >> 8; | ||||||
|  rgba[2] = c; |  rgba[2] = c; | ||||||
|  rgba[3] = 255; |  rgba[3] = 255; | ||||||
| } | } | ||||||
| static void v_getrgba32 (void *buffer, int offset, unsigned char rgba[4]) | static void v_getrgba32 (unsigned int offset, unsigned char rgba[4]) | ||||||
| { | { | ||||||
|  int c = ((word32 *)buffer)[offset]; |  word32 c = ((word32 *)vl_current_read_buffer)[offset]; | ||||||
|  rgba[0] = c >> 16; |  rgba[0] = c >> 16; | ||||||
|  rgba[1] = c >> 8; |  rgba[1] = c >> 8; | ||||||
|  rgba[2] = c;  |  rgba[2] = c;  | ||||||
| @@ -171,54 +245,186 @@ static void v_getrgba32 (void *buffer, int offset, unsigned char rgba[4]) | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* vl_sync_buffer: | /* Desc: pixel retrieval | ||||||
|  *  Syncs buffer with video hardware. Returns NULL in case of failure. |  * | ||||||
|  |  * In  : pixel offset | ||||||
|  |  * Out : pixel value | ||||||
|  |  * | ||||||
|  |  * Note: uses current read buffer | ||||||
|  */ |  */ | ||||||
| void *vl_sync_buffer (void *buffer, int x, int y, int width, int height) | static int v_getpixel8 (unsigned int offset) | ||||||
| { | { | ||||||
|  void *newbuf; |  return ((word8 *)vl_current_read_buffer)[offset]; | ||||||
|  | } | ||||||
|  | #define v_getpixel15 v_getpixel16 | ||||||
|  | static int v_getpixel16 (unsigned int offset) | ||||||
|  | { | ||||||
|  |  return ((word16 *)vl_current_read_buffer)[offset]; | ||||||
|  | } | ||||||
|  | static int v_getpixel24 (unsigned int offset) | ||||||
|  | { | ||||||
|  |  return *(word32 *)((long)vl_current_read_buffer+offset*3); | ||||||
|  | } | ||||||
|  | static int v_getpixel32 (unsigned int offset) | ||||||
|  | { | ||||||
|  |  return ((word32 *)vl_current_read_buffer)[offset]; | ||||||
|  | } | ||||||
|  |  | ||||||
|  if (width&3) { |  | ||||||
|     return NULL; |  | ||||||
|  } else { | /* Desc: set one palette entry | ||||||
|     if ((newbuf=realloc(buffer, width*height*video_bypp))!=NULL) { |  * | ||||||
|        vl_current_offset = video_scanlen * y + video_bypp * x; |  * In  : index, R, G, B | ||||||
|        current_width = width; |  * Out : - | ||||||
|        vl_current_delta = video_scanlen - video_bypp * width; |  * | ||||||
|     } |  * Note: color components are in range [0.0 .. 1.0] | ||||||
|     return newbuf; |  */ | ||||||
|  | void vl_setCI (int index, float red, float green, float blue) | ||||||
|  | { | ||||||
|  |  drv->setCI_f(index, red, green, blue); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: set one palette entry | ||||||
|  |  * | ||||||
|  |  * In  : color, R, G, B | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | static void fake_setcolor (int c, int r, int g, int b) | ||||||
|  | { | ||||||
|  |  VGAPalette[c] = 0xff000000 | (r<<16) | (g<<8) | b; | ||||||
|  |  | ||||||
|  |  drv->setCI_i(c, r, g, b); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: build FakeColor palette | ||||||
|  |  * | ||||||
|  |  * In  : CI precision in bits | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | static void fake_buildpalette (int bits) | ||||||
|  | { | ||||||
|  |  double c_r, c_g, c_b; | ||||||
|  |  int r, g, b, color = 0; | ||||||
|  |  | ||||||
|  |  double max = (1 << bits) - 1; | ||||||
|  |  | ||||||
|  |  for (b=0; b<B_CNT; ++b) { | ||||||
|  |      for (g=0; g<G_CNT; ++g) { | ||||||
|  |          for (r=0; r<R_CNT; ++r) { | ||||||
|  |              c_r = 0.5 + (double)r*(max-R_BIAS)/(R_CNT-1.) + R_BIAS; | ||||||
|  |              c_g = 0.5 + (double)g*(max-G_BIAS)/(G_CNT-1.) + G_BIAS; | ||||||
|  |              c_b = 0.5 + (double)b*(max-B_BIAS)/(B_CNT-1.) + B_BIAS; | ||||||
|  |              fake_setcolor(color++, (int)c_r, (int)c_g, (int)c_b); | ||||||
|  |          } | ||||||
|  |      } | ||||||
|  |  } | ||||||
|  |  | ||||||
|  |  for (color=0; color<256; color++) { | ||||||
|  |      c_r = (double)color*R_CNT/256.; | ||||||
|  |      c_g = (double)color*G_CNT/256.; | ||||||
|  |      c_b = (double)color*B_CNT/256.; | ||||||
|  |      array_r[color] = (int)c_r; | ||||||
|  |      array_g[color] = (int)c_g; | ||||||
|  |      array_b[color] = (int)c_b; | ||||||
|  } |  } | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* vl_setup_mode: | /* Desc: sync buffer with video hardware | ||||||
|  * |  * | ||||||
|  *  success: 0 |  * In  : ptr to old buffer, position, size | ||||||
|  *  failure: -1 |  * Out : 0 if success | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | int vl_sync_buffer (void **buffer, int x, int y, int width, int height) | ||||||
|  | { | ||||||
|  |  if ((width & 7) || (x < 0) || (y < 0) || (x+width > video_mode->xres) || (y+height > video_mode->yres)) { | ||||||
|  |     return -1; | ||||||
|  |  } else { | ||||||
|  |     void *newbuf = *buffer; | ||||||
|  |  | ||||||
|  |     if ((newbuf == NULL) || (vl_current_width != width) || (vl_current_height != height)) { | ||||||
|  |        newbuf = realloc(newbuf, width * height * video_bypp); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if (newbuf == NULL) { | ||||||
|  |        return -2; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     vl_current_width = width; | ||||||
|  |     vl_current_height = height; | ||||||
|  |     vl_current_stride = vl_current_width * video_bypp; | ||||||
|  |     vl_current_bytes = vl_current_stride * height; | ||||||
|  |  | ||||||
|  |     vl_current_offset = video_scanlen * y + video_bypp * x; | ||||||
|  |     vl_current_delta = video_scanlen - vl_current_stride; | ||||||
|  |  | ||||||
|  |     vl_current_draw_buffer = vl_current_read_buffer = *buffer = newbuf; | ||||||
|  |     return 0; | ||||||
|  |  } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: state retrieval | ||||||
|  |  * | ||||||
|  |  * In  : name, storage | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  |  */ | ||||||
|  | int vl_get (int pname, int *params) | ||||||
|  | { | ||||||
|  |  switch (pname) { | ||||||
|  |         case VL_GET_SCREEN_SIZE: | ||||||
|  |              params[0] = video_mode->xres; | ||||||
|  |              params[1] = video_mode->yres; | ||||||
|  |              break; | ||||||
|  |         default: | ||||||
|  |              return drv->get(pname, params); | ||||||
|  |  } | ||||||
|  |  return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Desc: setup mode | ||||||
|  |  * | ||||||
|  |  * In  : ptr to mode definition | ||||||
|  |  * Out : 0 if success | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  */ |  */ | ||||||
| static int vl_setup_mode (vl_mode *p) | static int vl_setup_mode (vl_mode *p) | ||||||
| { | { | ||||||
|  if (p->mode&0x4000) { |  if (p == NULL) { | ||||||
|     vl_flip = l_dump_virtual; |     return -1; | ||||||
|  } else { |  | ||||||
|     { int n; for (gran_shift=0, n=p->gran; n; gran_shift++, n>>=1) ; } |  | ||||||
|     gran_mask = (1<<(--gran_shift)) - 1; |  | ||||||
|     if ((unsigned)p->gran != (gran_mask+1)) { |  | ||||||
|        return -1; |  | ||||||
|     } |  | ||||||
|     vl_hw_granularity = p->gran; |  | ||||||
|     vl_flip = b_dump_virtual; |  | ||||||
|  } |  } | ||||||
|  |  | ||||||
| #define INITPTR(bpp) \ | #define INITPTR(bpp) \ | ||||||
|         vl_putpixel = v_putpixel##bpp; \ |         vl_putpixel = v_putpixel##bpp; \ | ||||||
|         vl_getrgba = v_getrgba##bpp;   \ |         vl_getrgba = v_getrgba##bpp;   \ | ||||||
|         vl_clear = v_clear##bpp;       \ |         vl_getpixel = v_getpixel##bpp; \ | ||||||
|  |         vl_rect = v_rect##bpp;         \ | ||||||
|  |         vl_mixfix = vl_mixfix##bpp;    \ | ||||||
|         vl_mixrgb = vl_mixrgb##bpp;    \ |         vl_mixrgb = vl_mixrgb##bpp;    \ | ||||||
|         vl_mixrgba = vl_mixrgba##bpp; |         vl_mixrgba = vl_mixrgba##bpp;  \ | ||||||
|  |         vl_clear = _can_mmx() ? v_clear##bpp##_mmx : v_clear##bpp | ||||||
|  |          | ||||||
|  switch (p->bpp) { |  switch (p->bpp) { | ||||||
|  |         case 8: | ||||||
|  |              INITPTR(8); | ||||||
|  |              break; | ||||||
|         case 15: |         case 15: | ||||||
|              INITPTR(15); |              INITPTR(15); | ||||||
|              break; |              break; | ||||||
| @@ -237,6 +443,7 @@ static int vl_setup_mode (vl_mode *p) | |||||||
|  |  | ||||||
| #undef INITPTR | #undef INITPTR | ||||||
|  |  | ||||||
|  |  video_mode = p; | ||||||
|  video_bypp = (p->bpp+7)/8; |  video_bypp = (p->bpp+7)/8; | ||||||
|  video_scanlen = p->scanlen; |  video_scanlen = p->scanlen; | ||||||
|  vl_video_selector = p->sel; |  vl_video_selector = p->sel; | ||||||
| @@ -246,32 +453,48 @@ static int vl_setup_mode (vl_mode *p) | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* vl_video_exit: | /* Desc: restore to the mode prior to first call to `vl_video_init'. | ||||||
|  *  Shutdown the video engine. |  * | ||||||
|  *  Restores to the mode prior to first call to `vl_video_init'. |  * In  : - | ||||||
|  |  * Out : - | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  */ |  */ | ||||||
| void vl_video_exit (void) | void vl_video_exit (void) | ||||||
| { | { | ||||||
|  drv->restore(); |  drv->restore(); | ||||||
|  drv->finit(); |  drv->fini(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* vl_video_init: | /* Desc: enter mode | ||||||
|  *  Enter mode. |  | ||||||
|  * |  * | ||||||
|  *  success: 0 |  * In  : xres, yres, bits/pixel, RGB, refresh rate | ||||||
|  *  failure: -1 |  * Out : pixel width in bits if success | ||||||
|  |  * | ||||||
|  |  * Note: - | ||||||
|  */ |  */ | ||||||
| int vl_video_init (int width, int height, int bpp, int refresh) | int vl_video_init (int width, int height, int bpp, int rgb, int refresh) | ||||||
| { | { | ||||||
|  |  int fake; | ||||||
|  vl_mode *p, *q; |  vl_mode *p, *q; | ||||||
|  unsigned int min; |  unsigned int min; | ||||||
|  |  | ||||||
|  |  fake = 0; | ||||||
|  |  if (!rgb) { | ||||||
|  |     bpp = 8; | ||||||
|  |  } else if (bpp == 8) { | ||||||
|  |     fake = 1; | ||||||
|  |  } | ||||||
|  |  | ||||||
|  /* initialize hardware */ |  /* initialize hardware */ | ||||||
|  if ((q=drv->getmodes()) == NULL) { |  drv = &VESA; | ||||||
|     return -1; |  if ((q=drv->init()) == NULL) { | ||||||
|  |     drv = &VGA; | ||||||
|  |     if ((q=drv->init()) == NULL) { | ||||||
|  |        return 0; | ||||||
|  |     } | ||||||
|  } |  } | ||||||
|  |  | ||||||
|  /* search for a mode that fits our request */ |  /* search for a mode that fits our request */ | ||||||
| @@ -284,11 +507,19 @@ int vl_video_init (int width, int height, int bpp, int refresh) | |||||||
|      } |      } | ||||||
|  } |  } | ||||||
|  |  | ||||||
|  /* check, setup and enter mode */ |  /* setup and enter mode */ | ||||||
|  if ((p!=NULL) && (vl_setup_mode(p) == 0) && (drv->entermode(p, refresh) == 0)) { |  if ((vl_setup_mode(p) == 0) && (drv->entermode(p, refresh) == 0)) { | ||||||
|     return 0; |     vl_flip = drv->blit; | ||||||
|  |     if (fake) { | ||||||
|  |        drv->get(VL_GET_CI_PREC, (int *)(&min)); | ||||||
|  |        fake_buildpalette(min); | ||||||
|  |        if (min == 8) { | ||||||
|  |           vl_getrgba = v_getrgba8fake8; | ||||||
|  |        } | ||||||
|  |     } | ||||||
|  |     return bpp; | ||||||
|  } |  } | ||||||
|  |  | ||||||
|  /* abort */ |  /* abort */ | ||||||
|  return -1; |  return 0; | ||||||
| } | } | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user